diff options
Diffstat (limited to 'boost/thread/pthread/thread_data.hpp')
-rw-r--r-- | boost/thread/pthread/thread_data.hpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/boost/thread/pthread/thread_data.hpp b/boost/thread/pthread/thread_data.hpp index 458bcd5422..836e6927c8 100644 --- a/boost/thread/pthread/thread_data.hpp +++ b/boost/thread/pthread/thread_data.hpp @@ -177,6 +177,7 @@ namespace boost thread_data_base* const thread_info; pthread_mutex_t* m; bool set; + bool done; void check_for_interruption() { @@ -193,7 +194,7 @@ namespace boost public: explicit interruption_checker(pthread_mutex_t* cond_mutex,pthread_cond_t* cond): thread_info(detail::get_current_thread_data()),m(cond_mutex), - set(thread_info && thread_info->interrupt_enabled) + set(thread_info && thread_info->interrupt_enabled), done(false) { if(set) { @@ -208,9 +209,10 @@ namespace boost BOOST_VERIFY(!pthread_mutex_lock(m)); } } - ~interruption_checker() + void check() { - if(set) + if ( ! done) { + if (set) { BOOST_VERIFY(!pthread_mutex_unlock(m)); lock_guard<mutex> guard(thread_info->data_mutex); @@ -221,6 +223,13 @@ namespace boost { BOOST_VERIFY(!pthread_mutex_unlock(m)); } + done = true; + } + } + + ~interruption_checker() BOOST_NOEXCEPT_IF(false) + { + check(); } }; #endif |