Boost logo

Boost-Commit :

From: anthony_at_[hidden]
Date: 2007-10-09 10:44:37


Author: anthonyw
Date: 2007-10-09 10:44:37 EDT (Tue, 09 Oct 2007)
New Revision: 39841
URL: http://svn.boost.org/trac/boost/changeset/39841

Log:
fixed more has-timed-lock backwards conditions
Text files modified:
   trunk/boost/thread/pthread/mutex.hpp | 4 ++--
   trunk/boost/thread/pthread/recursive_mutex.hpp | 4 +++-
   2 files changed, 5 insertions(+), 3 deletions(-)

Modified: trunk/boost/thread/pthread/mutex.hpp
==============================================================================
--- trunk/boost/thread/pthread/mutex.hpp (original)
+++ trunk/boost/thread/pthread/mutex.hpp 2007-10-09 10:44:37 EDT (Tue, 09 Oct 2007)
@@ -103,7 +103,7 @@
             {
                 throw thread_resource_error();
             }
-#ifdef BOOST_PTHREAD_HAS_TIMEDLOCK
+#ifndef BOOST_PTHREAD_HAS_TIMEDLOCK
             int const res2=pthread_cond_init(&cond,NULL);
             if(res2)
             {
@@ -118,7 +118,7 @@
         {
             int const res=pthread_mutex_destroy(&m);
             BOOST_ASSERT(!res);
-#ifdef BOOST_PTHREAD_HAS_TIMEDLOCK
+#ifndef BOOST_PTHREAD_HAS_TIMEDLOCK
             int const res2=pthread_cond_destroy(&cond);
             BOOST_ASSERT(!res2);
 #endif

Modified: trunk/boost/thread/pthread/recursive_mutex.hpp
==============================================================================
--- trunk/boost/thread/pthread/recursive_mutex.hpp (original)
+++ trunk/boost/thread/pthread/recursive_mutex.hpp 2007-10-09 10:44:37 EDT (Tue, 09 Oct 2007)
@@ -133,6 +133,8 @@
             int const res=pthread_mutex_init(&m,&attr);
             if(res)
             {
+ int const destroy_attr_res=pthread_mutexattr_destroy(&attr);
+ BOOST_ASSERT(!destroy_attr_res);
                 throw thread_resource_error();
             }
             int const destroy_attr_res=pthread_mutexattr_destroy(&attr);
@@ -247,7 +249,7 @@
             if(is_locked && owner==pthread_self())
             {
                 ++count;
- return;
+ return true;
             }
             while(is_locked)
             {


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