diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-11-24 20:33:19 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-11-24 20:35:17 (GMT) |
commit | 332d60c56dfaa11fdd135088279d15cd5983b3d4 (patch) | |
tree | dd77717a4e1732da929d5ff8a0471fa3f005e201 /3rdParty/Boost/src/boost/thread/pthread/thread_data.hpp | |
parent | 90c44a10fec26d2a0935b2d62e82b6a5be028373 (diff) | |
download | swift-contrib-332d60c56dfaa11fdd135088279d15cd5983b3d4.zip swift-contrib-332d60c56dfaa11fdd135088279d15cd5983b3d4.tar.bz2 |
Upgraded Boost to 1.45.0.
Diffstat (limited to '3rdParty/Boost/src/boost/thread/pthread/thread_data.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/thread/pthread/thread_data.hpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/3rdParty/Boost/src/boost/thread/pthread/thread_data.hpp b/3rdParty/Boost/src/boost/thread/pthread/thread_data.hpp index 730c77c..1bee28b 100644 --- a/3rdParty/Boost/src/boost/thread/pthread/thread_data.hpp +++ b/3rdParty/Boost/src/boost/thread/pthread/thread_data.hpp @@ -12,6 +12,7 @@ #include <boost/thread/mutex.hpp> #include <boost/optional.hpp> #include <pthread.h> +#include <boost/assert.hpp> #include "condition_variable_fwd.hpp" #include <map> @@ -55,6 +56,7 @@ namespace boost std::map<void const*,boost::detail::tss_data_node> tss_data; bool interrupt_enabled; bool interrupt_requested; + pthread_mutex_t* cond_mutex; pthread_cond_t* current_cond; thread_data_base(): @@ -76,6 +78,8 @@ namespace boost class interruption_checker { thread_data_base* const thread_info; + pthread_mutex_t* m; + bool set; void check_for_interruption() { @@ -88,23 +92,35 @@ namespace boost void operator=(interruption_checker&); public: - explicit interruption_checker(pthread_cond_t* cond): - thread_info(detail::get_current_thread_data()) + 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) { - if(thread_info && thread_info->interrupt_enabled) + if(set) { lock_guard<mutex> guard(thread_info->data_mutex); check_for_interruption(); + thread_info->cond_mutex=cond_mutex; thread_info->current_cond=cond; + BOOST_VERIFY(!pthread_mutex_lock(m)); + } + else + { + BOOST_VERIFY(!pthread_mutex_lock(m)); } } ~interruption_checker() { - if(thread_info && thread_info->interrupt_enabled) + if(set) { + BOOST_VERIFY(!pthread_mutex_unlock(m)); lock_guard<mutex> guard(thread_info->data_mutex); + thread_info->cond_mutex=NULL; thread_info->current_cond=NULL; - check_for_interruption(); + } + else + { + BOOST_VERIFY(!pthread_mutex_unlock(m)); } } }; |