From 4c8a55898239048a72dbfc1f936c7a4b19469041 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 12 Dec 2013 01:42:16 +0200 Subject: [PATCH] Check return values of pthread_* calls with BOOST_VERIFY, per #8904. --- include/boost/smart_ptr/detail/atomic_count_pthreads.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/boost/smart_ptr/detail/atomic_count_pthreads.hpp b/include/boost/smart_ptr/detail/atomic_count_pthreads.hpp index 05f7867..f99b910 100644 --- a/include/boost/smart_ptr/detail/atomic_count_pthreads.hpp +++ b/include/boost/smart_ptr/detail/atomic_count_pthreads.hpp @@ -11,6 +11,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // +#include #include // @@ -37,12 +38,12 @@ private: scoped_lock(pthread_mutex_t & m): m_(m) { - pthread_mutex_lock(&m_); + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); } ~scoped_lock() { - pthread_mutex_unlock(&m_); + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); } private: @@ -54,12 +55,12 @@ public: explicit atomic_count(long v): value_(v) { - pthread_mutex_init(&mutex_, 0); + BOOST_VERIFY( pthread_mutex_init( &mutex_, 0 ) == 0 ); } ~atomic_count() { - pthread_mutex_destroy(&mutex_); + BOOST_VERIFY( pthread_mutex_destroy( &mutex_ ) == 0 ); } long operator++()