Update of /cvsroot/boost/boost/boost/thread/win32
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22750
Modified Files:
Tag: thread_rewrite
basic_timed_mutex.hpp
Log Message:
Only get the semaphore once at the beginning of lock/timed_lock
Index: basic_timed_mutex.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/thread/win32/Attic/basic_timed_mutex.hpp,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -d -r1.1.2.4 -r1.1.2.5
--- basic_timed_mutex.hpp 4 Oct 2006 11:28:26 -0000 1.1.2.4
+++ basic_timed_mutex.hpp 5 Oct 2006 07:34:28 -0000 1.1.2.5
@@ -72,10 +72,12 @@
if(old_count&lock_flag_value)
{
bool lock_acquired=false;
+ void* const sem=get_semaphore();
+ ++old_count; // we're waiting, too
do
{
- old_count-=lock_flag_value;
-
BOOST_WAIT_FOR_SINGLE_OBJECT(get_semaphore(),BOOST_INFINITE);
+ old_count-=(lock_flag_value+1); // there will be one
less active thread on this mutex when it gets unlocked
+ BOOST_WAIT_FOR_SINGLE_OBJECT(sem,BOOST_INFINITE);
do
{
long const
current_count=BOOST_INTERLOCKED_COMPARE_EXCHANGE(&active_count,old_count|lock_flag_value,old_count);
@@ -107,11 +109,12 @@
if(old_count&lock_flag_value)
{
bool lock_acquired=false;
+ void* const sem=get_semaphore();
++old_count; // we're waiting, too
do
{
old_count-=(lock_flag_value+1); // there will be one
less active thread on this mutex when it gets unlocked
-
if(BOOST_WAIT_FOR_SINGLE_OBJECT(get_semaphore(),::boost::detail::get_milliseconds_until_time(target_time))!=0)
+
if(BOOST_WAIT_FOR_SINGLE_OBJECT(sem,::boost::detail::get_milliseconds_until_time(target_time))!=0)
{
BOOST_INTERLOCKED_DECREMENT(&active_count);
return false;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs