src/cxx_supportlib/vendor-modified/boost/thread/pthread/mutex.hpp in passenger-6.0.7 vs src/cxx_supportlib/vendor-modified/boost/thread/pthread/mutex.hpp in passenger-6.0.8

- old
+ new

@@ -31,14 +31,10 @@ #include <boost/thread/detail/delete.hpp> #include <boost/config/abi_prefix.hpp> -#ifndef BOOST_THREAD_HAS_NO_EINTR_BUG -#define BOOST_THREAD_HAS_EINTR_BUG -#endif - namespace boost { class BOOST_THREAD_CAPABILITY("mutex") mutex { @@ -47,21 +43,19 @@ public: BOOST_THREAD_NO_COPYABLE(mutex) mutex() { - int const res=pthread_mutex_init(&m,NULL); + int const res=posix::pthread_mutex_init(&m); if(res) { boost::throw_exception(thread_resource_error(res, "boost:: mutex constructor failed in pthread_mutex_init")); } } ~mutex() { - int const res = posix::pthread_mutex_destroy(&m); - boost::ignore_unused(res); - BOOST_ASSERT(!res); + BOOST_VERIFY(!posix::pthread_mutex_destroy(&m)); } void lock() BOOST_THREAD_ACQUIRE() { int res = posix::pthread_mutex_lock(&m); @@ -71,26 +65,16 @@ } } void unlock() BOOST_THREAD_RELEASE() { - int res = posix::pthread_mutex_unlock(&m); - (void)res; - BOOST_ASSERT(res == 0); -// if (res) -// { -// boost::throw_exception(lock_error(res,"boost: mutex unlock failed in pthread_mutex_unlock")); -// } + BOOST_VERIFY(!posix::pthread_mutex_unlock(&m)); } bool try_lock() BOOST_THREAD_TRY_ACQUIRE(true) { - int res; - do - { - res = posix::pthread_mutex_trylock(&m); - } while (res == EINTR); + int res = posix::pthread_mutex_trylock(&m); if (res==EBUSY) { return false; } @@ -122,30 +106,30 @@ #endif public: BOOST_THREAD_NO_COPYABLE(timed_mutex) timed_mutex() { - int const res=pthread_mutex_init(&m,NULL); + int const res=posix::pthread_mutex_init(&m); if(res) { boost::throw_exception(thread_resource_error(res, "boost:: timed_mutex constructor failed in pthread_mutex_init")); } #ifndef BOOST_THREAD_USES_PTHREAD_TIMEDLOCK - int const res2=pthread::cond_init(cond); + int const res2=posix::pthread_cond_init(&cond); if(res2) { BOOST_VERIFY(!posix::pthread_mutex_destroy(&m)); - boost::throw_exception(thread_resource_error(res2, "boost:: timed_mutex constructor failed in pthread::cond_init")); + boost::throw_exception(thread_resource_error(res2, "boost:: timed_mutex constructor failed in pthread_cond_init")); } is_locked=false; #endif } ~timed_mutex() { BOOST_VERIFY(!posix::pthread_mutex_destroy(&m)); #ifndef BOOST_THREAD_USES_PTHREAD_TIMEDLOCK - BOOST_VERIFY(!pthread_cond_destroy(&cond)); + BOOST_VERIFY(!posix::pthread_cond_destroy(&cond)); #endif } #if defined BOOST_THREAD_USES_DATETIME template<typename TimeDuration> @@ -190,26 +174,16 @@ } } void unlock() { - int res = posix::pthread_mutex_unlock(&m); - (void)res; - BOOST_ASSERT(res == 0); -// if (res) -// { -// boost::throw_exception(lock_error(res,"boost: mutex unlock failed in pthread_mutex_unlock")); -// } + BOOST_VERIFY(!posix::pthread_mutex_unlock(&m)); } bool try_lock() { - int res; - do - { - res = posix::pthread_mutex_trylock(&m); - } while (res == EINTR); + int res = posix::pthread_mutex_trylock(&m); if (res==EBUSY) { return false; } @@ -259,10 +233,10 @@ bool do_try_lock_until(detail::internal_platform_timepoint const &timeout) { boost::pthread::pthread_mutex_scoped_lock const local_lock(&m); while(is_locked) { - int const cond_res=pthread_cond_timedwait(&cond,&m,&timeout.getTs()); + int const cond_res=posix::pthread_cond_timedwait(&cond,&m,&timeout.getTs()); if(cond_res==ETIMEDOUT) { break; } BOOST_ASSERT(!cond_res);