--- boost/thread/pthread/condition_variable_fwd.hpp.old 2015-04-18 05:56:34.000000000 -0400 +++ boost/thread/pthread/condition_variable_fwd.hpp 2017-04-20 04:09:26.656070060 -0400 @@ -32,9 +32,12 @@ class condition_variable { private: -#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS + +//#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS + // This data must be present so that with-and-without + // interrupts the structure is the same for ABI compatibility pthread_mutex_t internal_mutex; -#endif +//#endif pthread_cond_t cond; public: @@ -55,31 +58,37 @@ BOOST_THREAD_NO_COPYABLE(condition_variable) condition_variable() { -#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS +//#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS + // Even if it is not used, the internal_mutex exists (see + // above) and must be initialized (etc) in case some + // compilation units provide interruptions and others + // don't. int const res=pthread_mutex_init(&internal_mutex,NULL); if(res) { boost::throw_exception(thread_resource_error(res, "boost::condition_variable::condition_variable() constructor failed in pthread_mutex_init")); } -#endif +//#endif int const res2=pthread_cond_init(&cond,NULL); if(res2) { -#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS +//#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS + // ditto BOOST_VERIFY(!pthread_mutex_destroy(&internal_mutex)); -#endif +//#endif boost::throw_exception(thread_resource_error(res2, "boost::condition_variable::condition_variable() constructor failed in pthread_cond_init")); } } ~condition_variable() { int ret; -#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS +//#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS + // ditto do { ret = pthread_mutex_destroy(&internal_mutex); } while (ret == EINTR); BOOST_ASSERT(!ret); -#endif +//#endif do { ret = pthread_cond_destroy(&cond); } while (ret == EINTR);