Boost logo

Boost-Commit :

From: anthony_at_[hidden]
Date: 2007-11-01 13:18:55


Author: anthonyw
Date: 2007-11-01 13:18:54 EDT (Thu, 01 Nov 2007)
New Revision: 40650
URL: http://svn.boost.org/trac/boost/changeset/40650

Log:
shared_mutex lock functions are not cancellation points
Text files modified:
   trunk/boost/thread/pthread/shared_mutex.hpp | 15 +++++++++++----
   1 files changed, 11 insertions(+), 4 deletions(-)

Modified: trunk/boost/thread/pthread/shared_mutex.hpp
==============================================================================
--- trunk/boost/thread/pthread/shared_mutex.hpp (original)
+++ trunk/boost/thread/pthread/shared_mutex.hpp 2007-11-01 13:18:54 EDT (Thu, 01 Nov 2007)
@@ -10,7 +10,7 @@
 #include <boost/assert.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/thread/mutex.hpp>
-#include <boost/thread/condition.hpp>
+#include <boost/thread/condition_variable.hpp>
 
 namespace boost
 {
@@ -29,9 +29,9 @@
 
         state_data state;
         boost::mutex state_change;
- boost::condition shared_cond;
- boost::condition exclusive_cond;
- boost::condition upgrade_cond;
+ boost::condition_variable shared_cond;
+ boost::condition_variable exclusive_cond;
+ boost::condition_variable upgrade_cond;
 
         void release_waiters()
         {
@@ -53,6 +53,7 @@
 
         void lock_shared()
         {
+ boost::this_thread::disable_cancellation no_cancel;
             boost::mutex::scoped_lock lock(state_change);
                 
             while(true)
@@ -84,6 +85,7 @@
 
         bool timed_lock_shared(system_time const& timeout)
         {
+ boost::this_thread::disable_cancellation no_cancel;
             boost::mutex::scoped_lock lock(state_change);
                 
             while(true)
@@ -124,6 +126,7 @@
 
         void lock()
         {
+ boost::this_thread::disable_cancellation no_cancel;
             boost::mutex::scoped_lock lock(state_change);
                 
             while(true)
@@ -143,6 +146,7 @@
 
         bool timed_lock(system_time const& timeout)
         {
+ boost::this_thread::disable_cancellation no_cancel;
             boost::mutex::scoped_lock lock(state_change);
                 
             while(true)
@@ -189,6 +193,7 @@
 
         void lock_upgrade()
         {
+ boost::this_thread::disable_cancellation no_cancel;
             boost::mutex::scoped_lock lock(state_change);
             while(true)
             {
@@ -205,6 +210,7 @@
 
         bool timed_lock_upgrade(system_time const& timeout)
         {
+ boost::this_thread::disable_cancellation no_cancel;
             boost::mutex::scoped_lock lock(state_change);
             while(true)
             {
@@ -252,6 +258,7 @@
 
         void unlock_upgrade_and_lock()
         {
+ boost::this_thread::disable_cancellation no_cancel;
             boost::mutex::scoped_lock lock(state_change);
             --state.shared_count;
             while(true)


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk