diff --git a/boost/thread/pthread/condition_variable.hpp b/boost/thread/pthread/condition_variable.hpp index 160c707..07e61f2 100644 --- a/boost/thread/pthread/condition_variable.hpp +++ b/boost/thread/pthread/condition_variable.hpp @@ -52,7 +52,10 @@ namespace boost thread_cv_detail::lock_on_exit > guard; detail::interruption_checker check_for_interruption(&internal_mutex,&cond); guard.activate(m); - res=pthread_cond_wait(&cond,&internal_mutex); + int ret; + do { + ret = pthread_cond_wait(&cond,m.mutex()->native_handle()); + } while (ret == EINTR); } this_thread::interruption_point(); if(res) diff --git a/boost/thread/pthread/condition_variable_fwd.hpp b/boost/thread/pthread/condition_variable_fwd.hpp index 365f511..b94c735 100644 --- a/boost/thread/pthread/condition_variable_fwd.hpp +++ b/boost/thread/pthread/condition_variable_fwd.hpp @@ -44,7 +44,10 @@ namespace boost ~condition_variable() { BOOST_VERIFY(!pthread_mutex_destroy(&internal_mutex)); - BOOST_VERIFY(!pthread_cond_destroy(&cond)); + int ret; + do { + ret = pthread_cond_destroy(&cond); + } while (ret == EINTR); } void wait(unique_lock& m); diff --git a/boost/thread/pthread/mutex.hpp b/boost/thread/pthread/mutex.hpp index 2a326d7..4a4205d 100644 --- a/boost/thread/pthread/mutex.hpp +++ b/boost/thread/pthread/mutex.hpp @@ -44,26 +44,39 @@ namespace boost } ~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); - if(res) - { + int res; + do { + res = pthread_mutex_lock(&m); + } while (res == EINTR); + + if (res) { boost::throw_exception(lock_error(res)); } } 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));