Check return values of pthread_* calls with BOOST_VERIFY, per #8904.

This commit is contained in:
Peter Dimov
2013-12-12 01:42:16 +02:00
parent a41b81f1c8
commit 4c8a558982

View File

@@ -11,6 +11,7 @@
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#include <boost/assert.hpp>
#include <pthread.h> #include <pthread.h>
// //
@@ -37,12 +38,12 @@ private:
scoped_lock(pthread_mutex_t & m): m_(m) scoped_lock(pthread_mutex_t & m): m_(m)
{ {
pthread_mutex_lock(&m_); BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
} }
~scoped_lock() ~scoped_lock()
{ {
pthread_mutex_unlock(&m_); BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
} }
private: private:
@@ -54,12 +55,12 @@ public:
explicit atomic_count(long v): value_(v) explicit atomic_count(long v): value_(v)
{ {
pthread_mutex_init(&mutex_, 0); BOOST_VERIFY( pthread_mutex_init( &mutex_, 0 ) == 0 );
} }
~atomic_count() ~atomic_count()
{ {
pthread_mutex_destroy(&mutex_); BOOST_VERIFY( pthread_mutex_destroy( &mutex_ ) == 0 );
} }
long operator++() long operator++()