[ https://issues.apache.org/jira/browse/THRIFT-1272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13167214#comment-13167214 ]
Hudson commented on THRIFT-1272: -------------------------------- Integrated in Thrift #361 (See [https://builds.apache.org/job/Thrift/361/]) THRIFT-1272 add subclass of ReadWriteMutex that avoids writer starvation Patch: Dave Watson roger : http://svn.apache.org/viewvc/?view=rev&rev=1213067 Files : * /thrift/trunk/lib/cpp/src/concurrency/Mutex.cpp * /thrift/trunk/lib/cpp/src/concurrency/Mutex.h * /thrift/trunk/lib/cpp/test/Makefile.am * /thrift/trunk/lib/cpp/test/RWMutexStarveTest.cpp > add subclass of ReadWriteMutex that avoids writer > --------------------------------------------------- > > Key: THRIFT-1272 > URL: https://issues.apache.org/jira/browse/THRIFT-1272 > Project: Thrift > Issue Type: Improvement > Components: C++ - Library > Reporter: Dave Watson > Assignee: Dave Watson > Priority: Minor > Attachments: > 0004-add-subclass-of-ReadWriteMutex-that-avoids-writer-st.patch.diff > > > From e30d5bc332d7671ecaf3dd95fea1d8693506923d Mon Sep 17 00:00:00 2001 > From: Doug Ihde <di...@fb.com> > Date: Mon, 22 Feb 2010 23:36:52 +0000 > Subject: [PATCH 04/33] add subclass of ReadWriteMutex that avoids writer > starvation > Summary: The ReadWriteMutex class does not guarantee that writers will not > suffer from starvation. This new subclass provides such a > guarantee. > Also fixing a bug in ReadWriteMutex attemptRead() and > attemptWrite() where the return value is the opposite of what is > documented. > Test Plan: I wrote a simple program that launches 3 reader threads and 2 > writer thread to demonstrate the starvation. With a regular > ReadWriteMutex, the writer threads never acquire the lock. With > the new subclass, they acquire the lock as expected. > --- > lib/cpp/src/concurrency/Mutex.cpp | 34 +++++++- > lib/cpp/src/concurrency/Mutex.h | 19 ++++ > lib/cpp/test/Makefile.am | 5 +- > lib/cpp/test/RWMutexStarveTest.cpp | 168 > ++++++++++++++++++++++++++++++++++++ > 4 files changed, 222 insertions(+), 4 deletions(-) > create mode 100644 lib/cpp/test/RWMutexStarveTest.cpp -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira