|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r82828 - trunk/boost/thread/win32
From: anthony_at_[hidden]
Date: 2013-02-12 03:21:41
Author: anthonyw
Date: 2013-02-12 03:21:40 EST (Tue, 12 Feb 2013)
New Revision: 82828
URL: http://svn.boost.org/trac/boost/changeset/82828
Log:
Modify mark_waiting_and_try_lock to return modified count if mutex already locked
Text files modified:
trunk/boost/thread/win32/basic_timed_mutex.hpp | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
Modified: trunk/boost/thread/win32/basic_timed_mutex.hpp
==============================================================================
--- trunk/boost/thread/win32/basic_timed_mutex.hpp (original)
+++ trunk/boost/thread/win32/basic_timed_mutex.hpp 2013-02-12 03:21:40 EST (Tue, 12 Feb 2013)
@@ -93,10 +93,13 @@
{
for(;;)
{
- long const new_count=(old_count&lock_flag_value)?(old_count+1):(old_count|lock_flag_value);
+ bool const was_locked=(old_count&lock_flag_value);
+ long const new_count=was_locked?(old_count+1):(old_count|lock_flag_value);
long const current=BOOST_INTERLOCKED_COMPARE_EXCHANGE(&active_count,new_count,old_count);
if(current==old_count)
{
+ if(was_locked)
+ old_count=new_count;
break;
}
old_count=current;
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