Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75882 - trunk/boost/thread/pthread
From: vicente.botet_at_[hidden]
Date: 2011-12-10 05:55:54


Author: viboes
Date: 2011-12-10 05:55:53 EST (Sat, 10 Dec 2011)
New Revision: 75882
URL: http://svn.boost.org/trac/boost/changeset/75882

Log:
Thread: #6200-mutex error better handle EINTR
Text files modified:
   trunk/boost/thread/pthread/mutex.hpp | 25 +++++++++++++++++++++----
   1 files changed, 21 insertions(+), 4 deletions(-)

Modified: trunk/boost/thread/pthread/mutex.hpp
==============================================================================
--- trunk/boost/thread/pthread/mutex.hpp (original)
+++ trunk/boost/thread/pthread/mutex.hpp 2011-12-10 05:55:53 EST (Sat, 10 Dec 2011)
@@ -44,12 +44,20 @@
         }
         ~mutex()
         {
- BOOST_VERIFY(!pthread_mutex_destroy(&m));
+ int ret;
+ do
+ {
+ ret = pthread_mutex_destroy(&m);
+ } while (ret == EINTR);
         }
 
         void lock()
         {
- int const res=pthread_mutex_lock(&m);
+ int res;
+ do
+ {
+ res = pthread_mutex_lock(&m);
+ } while (res == EINTR);
             if(res)
             {
                 boost::throw_exception(lock_error(res));
@@ -58,12 +66,21 @@
 
         void unlock()
         {
- BOOST_VERIFY(!pthread_mutex_unlock(&m));
+ int ret;
+ do
+ {
+ ret = pthread_mutex_unlock(&m);
+ } while (ret == EINTR);
+ BOOST_VERIFY(!ret);
         }
 
         bool try_lock()
         {
- int const res=pthread_mutex_trylock(&m);
+ int res;
+ do
+ {
+ res = pthread_mutex_trylock(&m);
+ } while (res == EINTR);
             if(res && (res!=EBUSY))
             {
                 boost::throw_exception(lock_error(res));


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