mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-08-01 21:54:28 +02:00
Check return values of pthread_* calls with BOOST_VERIFY, per #8904.
This commit is contained in:
@@ -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++()
|
||||||
|
Reference in New Issue
Block a user