diff -r bd29b3e4c72d -r abf2ee553b11 include/boost/interprocess/sync/interprocess_condition.hpp --- a/include/boost/interprocess/sync/interprocess_condition.hpp Mon Aug 26 11:00:12 2013 +0200 +++ b/include/boost/interprocess/sync/interprocess_condition.hpp Tue Aug 27 18:07:27 2013 +0200 @@ -72,13 +72,13 @@ //!If there is a thread waiting on *this, change that //!thread's state to ready. Otherwise there is no effect. - void notify_one() - { m_condition.notify_one(); } + bool notify_one(const boost::posix_time::ptime &abs_time) + { return m_condition.notify_one(abs_time); } //!Change the state of all threads waiting on *this to ready. //!If there are no waiting threads, notify_all() has no effect. - void notify_all() - { m_condition.notify_all(); } + bool notify_all(const boost::posix_time::ptime &abs_time) + { return m_condition.notify_all(abs_time); } //!Releases the lock on the interprocess_mutex object associated with lock, blocks //!the current thread of execution until readied by a call to diff -r bd29b3e4c72d -r abf2ee553b11 include/boost/interprocess/sync/spin/condition.hpp --- a/include/boost/interprocess/sync/spin/condition.hpp Mon Aug 26 11:00:12 2013 +0200 +++ b/include/boost/interprocess/sync/spin/condition.hpp Tue Aug 27 18:07:27 2013 +0200 @@ -34,8 +34,8 @@ spin_condition(); ~spin_condition(); - void notify_one(); - void notify_all(); + bool notify_one(const boost::posix_time::ptime &abs_time); + bool notify_all(const boost::posix_time::ptime &abs_time); template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) @@ -97,7 +97,7 @@ spin_mutex m_enter_mut; volatile boost::uint32_t m_command; volatile boost::uint32_t m_num_waiters; - void notify(boost::uint32_t command); + bool notify(boost::uint32_t command, const boost::posix_time::ptime &abs_time); }; inline spin_condition::spin_condition() @@ -114,29 +114,35 @@ //Trivial destructor } -inline void spin_condition::notify_one() +inline bool spin_condition::notify_one(const boost::posix_time::ptime &abs_time) { - this->notify(NOTIFY_ONE); + return this->notify(NOTIFY_ONE, abs_time); } -inline void spin_condition::notify_all() +inline bool spin_condition::notify_all(const boost::posix_time::ptime &abs_time) { - this->notify(NOTIFY_ALL); + return this->notify(NOTIFY_ALL, abs_time); } -inline void spin_condition::notify(boost::uint32_t command) +inline bool spin_condition::notify(boost::uint32_t command, + const boost::posix_time::ptime &abs_time) { //This mutex guarantees that no other thread can enter to the //do_timed_wait method logic, so that thread count will be //constant until the function writes a NOTIFY_ALL command. //It also guarantees that no other notification can be signaled //on this spin_condition before this one ends - m_enter_mut.lock(); + + //Fix the situation where one process dies while having m_enter_mut locked + //by providing a timeout on the lock call + if(!m_enter_mut.timed_lock(abs_time)){ + return false; + } //Return if there are no waiters if(!atomic_read32(&m_num_waiters)) { m_enter_mut.unlock(); - return; + return true; } //Notify that all threads should execute wait logic @@ -150,6 +156,7 @@ } */ //The enter mutex will rest locked until the last waiting thread unlocks it + return true; } template