Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86001 - in trunk/boost/interprocess/sync: detail spin windows
From: igaztanaga_at_[hidden]
Date: 2013-09-29 07:46:58


Author: igaztanaga
Date: 2013-09-29 07:46:58 EDT (Sun, 29 Sep 2013)
New Revision: 86001
URL: http://svn.boost.org/trac/boost/changeset/86001

Log:
Notify all waiting threads in destructor to allow POSIX semantics on condition variables destruction.

Text files modified:
   trunk/boost/interprocess/sync/detail/condition_algorithm_8a.hpp | 3 ++-
   trunk/boost/interprocess/sync/spin/condition.hpp | 4 +++-
   trunk/boost/interprocess/sync/windows/condition.hpp | 6 +++++-
   trunk/boost/interprocess/sync/windows/named_condition_any.hpp | 3 +--
   4 files changed, 11 insertions(+), 5 deletions(-)

Modified: trunk/boost/interprocess/sync/detail/condition_algorithm_8a.hpp
==============================================================================
--- trunk/boost/interprocess/sync/detail/condition_algorithm_8a.hpp Sun Sep 29 07:44:19 2013 (r86000)
+++ trunk/boost/interprocess/sync/detail/condition_algorithm_8a.hpp 2013-09-29 07:46:58 EDT (Sun, 29 Sep 2013) (r86001)
@@ -324,7 +324,8 @@
 
    condition_8a_wrapper(){}
 
- ~condition_8a_wrapper(){}
+ //Compiler-generated destructor is OK
+ //~condition_8a_wrapper(){}
 
    ConditionMembers & get_members()
    { return m_data; }

Modified: trunk/boost/interprocess/sync/spin/condition.hpp
==============================================================================
--- trunk/boost/interprocess/sync/spin/condition.hpp Sun Sep 29 07:44:19 2013 (r86000)
+++ trunk/boost/interprocess/sync/spin/condition.hpp 2013-09-29 07:46:58 EDT (Sun, 29 Sep 2013) (r86001)
@@ -112,7 +112,9 @@
 
 inline spin_condition::~spin_condition()
 {
- //Trivial destructor
+ //Notify all waiting threads
+ //to allow POSIX semantics on condition destruction
+ this->notify_all();
 }
 
 inline void spin_condition::notify_one()

Modified: trunk/boost/interprocess/sync/windows/condition.hpp
==============================================================================
--- trunk/boost/interprocess/sync/windows/condition.hpp Sun Sep 29 07:44:19 2013 (r86000)
+++ trunk/boost/interprocess/sync/windows/condition.hpp 2013-09-29 07:46:58 EDT (Sun, 29 Sep 2013) (r86001)
@@ -38,7 +38,11 @@
    {}
 
    ~windows_condition()
- {}
+ {
+ //Notify all waiting threads
+ //to allow POSIX semantics on condition destruction
+ this->notify_all();
+ }
 
    void notify_one()
    { m_condition_data.notify_one(); }

Modified: trunk/boost/interprocess/sync/windows/named_condition_any.hpp
==============================================================================
--- trunk/boost/interprocess/sync/windows/named_condition_any.hpp Sun Sep 29 07:44:19 2013 (r86000)
+++ trunk/boost/interprocess/sync/windows/named_condition_any.hpp 2013-09-29 07:46:58 EDT (Sun, 29 Sep 2013) (r86001)
@@ -134,8 +134,6 @@
       winapi_mutex_wrapper m_mtx_unblock_lock;
    };
 
- ipcdetail::condition_8a_wrapper<condition_data> m_condition_data;
-
    class named_cond_callbacks : public windows_named_sync_interface
    {
       typedef __int64 sem_count_t;
@@ -229,6 +227,7 @@
    };
 
    windows_named_sync m_named_sync;
+ ipcdetail::condition_8a_wrapper<condition_data> m_condition_data;
    /// @endcond
 };
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk