From fcc027369fc1e92efa8550ce26cb3b01e1343ef9 Mon Sep 17 00:00:00 2001 From: "Vicente J. Botet Escriba" Date: Tue, 17 Sep 2013 21:01:05 +0000 Subject: [PATCH] Thread: try to fix win32 condition_variable issue #7461. [SVN r85733] --- include/boost/thread/win32/condition_variable.hpp | 11 +++++------ include/boost/thread/win32/thread_data.hpp | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/boost/thread/win32/condition_variable.hpp b/include/boost/thread/win32/condition_variable.hpp index d07ddcbe..359c21ec 100644 --- a/include/boost/thread/win32/condition_variable.hpp +++ b/include/boost/thread/win32/condition_variable.hpp @@ -191,18 +191,17 @@ namespace boost struct entry_manager { entry_ptr const entry; + boost::mutex& internal_mutex; BOOST_THREAD_NO_COPYABLE(entry_manager) - entry_manager(entry_ptr const& entry_): - entry(entry_) + entry_manager(entry_ptr const& entry_, boost::mutex& mutex_): + entry(entry_), internal_mutex(mutex_) {} ~entry_manager() { - //if(! entry->is_notified()) // several regression #7657 - { + boost::lock_guard internal_lock(internal_mutex); entry->remove_waiter(); - } } list_entry* operator->() @@ -218,7 +217,7 @@ namespace boost { relocker locker(lock); - entry_manager entry(get_wait_entry()); + entry_manager entry(get_wait_entry(), internal_mutex); locker.unlock(); diff --git a/include/boost/thread/win32/thread_data.hpp b/include/boost/thread/win32/thread_data.hpp index 8f0ae347..d2db5154 100644 --- a/include/boost/thread/win32/thread_data.hpp +++ b/include/boost/thread/win32/thread_data.hpp @@ -148,7 +148,7 @@ namespace boost virtual void run()=0; - void notify_all_at_thread_exit(condition_variable* cv, mutex* m) + virtual void notify_all_at_thread_exit(condition_variable* cv, mutex* m) { notify.push_back(std::pair(cv, m)); }