--- ./boost/thread/pthread/condition_variable.hpp 2008-07-08 03:44:55.000000000 -0400 +++ ../boost_1_36_0-patched/boost/thread/pthread/condition_variable.hpp 2008-09-16 09:19:06.348750000 -0400 @@ -14,17 +14,17 @@ namespace boost { inline void condition_variable::wait(unique_lock& m) { - detail::interruption_checker check_for_interruption(&cond); + detail::interruption_checker check_for_interruption(&cond,m.mutex()->native_handle()); BOOST_VERIFY(!pthread_cond_wait(&cond,m.mutex()->native_handle())); } inline bool condition_variable::timed_wait(unique_lock& m,boost::system_time const& wait_until) { - detail::interruption_checker check_for_interruption(&cond); + detail::interruption_checker check_for_interruption(&cond,m.mutex()->native_handle()); struct timespec const timeout=detail::get_timespec(wait_until); int const cond_res=pthread_cond_timedwait(&cond,m.mutex()->native_handle(),&timeout); if(cond_res==ETIMEDOUT) { return false; --- ./boost/thread/pthread/thread_data.hpp 2008-06-18 09:01:08.000000000 -0400 +++ ../boost_1_36_0-patched/boost/thread/pthread/thread_data.hpp 2008-09-16 09:22:52.942500000 -0400 @@ -42,10 +42,11 @@ bool joined; boost::detail::thread_exit_callback_node* thread_exit_callbacks; 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(): done(false),join_started(false),joined(false), thread_exit_callbacks(0),tss_data(0), @@ -75,26 +76,29 @@ } } void operator=(interruption_checker&); public: - explicit interruption_checker(pthread_cond_t* cond): + explicit interruption_checker(pthread_cond_t* cond, + pthread_mutex_t* m): thread_info(detail::get_current_thread_data()) { if(thread_info && thread_info->interrupt_enabled) { lock_guard guard(thread_info->data_mutex); check_for_interruption(); thread_info->current_cond=cond; + thread_info->cond_mutex=m; } } ~interruption_checker() { if(thread_info && thread_info->interrupt_enabled) { lock_guard guard(thread_info->data_mutex); thread_info->current_cond=NULL; + thread_info->cond_mutex=NULL; check_for_interruption(); } } }; } --- ./libs/thread/src/pthread/thread.cpp 2008-07-23 05:35:40.000000000 -0400 +++ ../boost_1_36_0-patched/libs/thread/src/pthread/thread.cpp 2008-09-16 09:27:04.692500000 -0400 @@ -418,16 +418,24 @@ void thread::interrupt() { detail::thread_data_ptr const local_thread_info=get_thread_info(); if(local_thread_info) { + pthread_cond_t* current_cond; + pthread_mutex_t* cond_mutex; + { lock_guard lk(local_thread_info->data_mutex); local_thread_info->interrupt_requested=true; - if(local_thread_info->current_cond) - { - BOOST_VERIFY(!pthread_cond_broadcast(local_thread_info->current_cond)); - } + current_cond = local_thread_info->current_cond; + cond_mutex = local_thread_info->cond_mutex; + } + if(current_cond) + { + BOOST_VERIFY(!pthread_mutex_lock(cond_mutex)); + BOOST_VERIFY(!pthread_cond_broadcast(current_cond)); + BOOST_VERIFY(!pthread_mutex_unlock(cond_mutex)); + } } } bool thread::interruption_requested() const {