|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62553 - trunk/boost/thread/win32
From: anthony_at_[hidden]
Date: 2010-06-08 03:28:56
Author: anthonyw
Date: 2010-06-08 03:28:53 EDT (Tue, 08 Jun 2010)
New Revision: 62553
URL: http://svn.boost.org/trac/boost/changeset/62553
Log:
Check limits when attempting to lock shared_mutex --- trac issue #2293
Text files modified:
trunk/boost/thread/win32/shared_mutex.hpp | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 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 2010-06-08 03:28:53 EDT (Tue, 08 Jun 2010)
@@ -99,6 +99,10 @@
if(!new_state.exclusive && !new_state.exclusive_waiting_blocked)
{
++new_state.shared_count;
+ if(!new_state.shared_count)
+ {
+ return false;
+ }
}
state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state);
@@ -133,10 +137,18 @@
if(new_state.exclusive || new_state.exclusive_waiting_blocked)
{
++new_state.shared_waiting;
+ if(!new_state.shared_waiting)
+ {
+ boost::throw_exception(boost::lock_error());
+ }
}
else
{
++new_state.shared_count;
+ if(!new_state.shared_count)
+ {
+ boost::throw_exception(boost::lock_error());
+ }
}
state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state);
@@ -168,6 +180,10 @@
else
{
++new_state.shared_count;
+ if(!new_state.shared_count)
+ {
+ return false;
+ }
}
state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state);
@@ -284,6 +300,11 @@
if(new_state.shared_count || new_state.exclusive)
{
++new_state.exclusive_waiting;
+ if(!new_state.exclusive_waiting)
+ {
+ boost::throw_exception(boost::lock_error());
+ }
+
new_state.exclusive_waiting_blocked=true;
}
else
@@ -376,10 +397,18 @@
if(new_state.exclusive || new_state.exclusive_waiting_blocked || new_state.upgrade)
{
++new_state.shared_waiting;
+ if(!new_state.shared_waiting)
+ {
+ boost::throw_exception(boost::lock_error());
+ }
}
else
{
++new_state.shared_count;
+ if(!new_state.shared_count)
+ {
+ boost::throw_exception(boost::lock_error());
+ }
new_state.upgrade=true;
}
@@ -413,6 +442,10 @@
else
{
++new_state.shared_count;
+ if(!new_state.shared_count)
+ {
+ return false;
+ }
new_state.upgrade=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