Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83397 - trunk/boost/thread/win32
From: vicente.botet_at_[hidden]
Date: 2013-03-10 11:17:50


Author: viboes
Date: 2013-03-10 11:17:50 EDT (Sun, 10 Mar 2013)
New Revision: 83397
URL: http://svn.boost.org/trac/boost/changeset/83397

Log:
Thread: notify win32/shared_mutex when setting new_state.exclusive_waiting_blocked=false;
Text files modified:
   trunk/boost/thread/win32/shared_mutex.hpp | 13 +++++++++++++
   1 files changed, 13 insertions(+), 0 deletions(-)

Modified: trunk/boost/thread/win32/shared_mutex.hpp
==============================================================================
--- trunk/boost/thread/win32/shared_mutex.hpp (original)
+++ trunk/boost/thread/win32/shared_mutex.hpp 2013-03-10 11:17:50 EDT (Sun, 10 Mar 2013)
@@ -471,6 +471,7 @@
                 {
                     for(;;)
                     {
+ bool must_notify = false;
                         state_data new_state=old_state;
                         if(new_state.shared_count || new_state.exclusive)
                         {
@@ -479,6 +480,7 @@
                                 if(!--new_state.exclusive_waiting)
                                 {
                                     new_state.exclusive_waiting_blocked=false;
+ must_notify = true;
                                 }
                             }
                         }
@@ -488,6 +490,11 @@
                         }
 
                         state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state);
+ if (must_notify)
+ {
+ BOOST_VERIFY(detail::win32::ReleaseSemaphore(semaphores[unlock_sem],1,0)!=0);
+ }
+
                         if(current_state==old_state)
                         {
                             break;
@@ -580,6 +587,7 @@
             {
               for(;;)
               {
+ bool must_notify = false;
                 state_data new_state=old_state;
                 if(new_state.shared_count || new_state.exclusive)
                 {
@@ -588,6 +596,7 @@
                     if(!--new_state.exclusive_waiting)
                     {
                       new_state.exclusive_waiting_blocked=false;
+ must_notify = true;
                     }
                   }
                 }
@@ -597,6 +606,10 @@
                 }
 
                 state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state);
+ if (must_notify)
+ {
+ BOOST_VERIFY(detail::win32::ReleaseSemaphore(semaphores[unlock_sem],1,0)!=0);
+ }
                 if(current_state==old_state)
                 {
                   break;


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