Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50598 - sandbox/thread_safe_signals/trunk/boost/signals2
From: fmhess_at_[hidden]
Date: 2009-01-14 15:46:44


Author: fmhess
Date: 2009-01-14 15:46:43 EST (Wed, 14 Jan 2009)
New Revision: 50598
URL: http://svn.boost.org/trac/boost/changeset/50598

Log:
Made shared_connection_block::blocking show its documented
behavior even after underlying connection has expired.

Text files modified:
   sandbox/thread_safe_signals/trunk/boost/signals2/shared_connection_block.hpp | 17 ++++++++++++-----
   1 files changed, 12 insertions(+), 5 deletions(-)

Modified: sandbox/thread_safe_signals/trunk/boost/signals2/shared_connection_block.hpp
==============================================================================
--- sandbox/thread_safe_signals/trunk/boost/signals2/shared_connection_block.hpp (original)
+++ sandbox/thread_safe_signals/trunk/boost/signals2/shared_connection_block.hpp 2009-01-14 15:46:43 EST (Wed, 14 Jan 2009)
@@ -29,10 +29,16 @@
       }
       void block()
       {
- if(_blocker) return;
- boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
- if(connectionBody == 0) return;
- _blocker = connectionBody->get_blocker();
+ if(blocking()) return;
+ boost::shared_ptr<detail::connection_body_base> connection_body(_weak_connection_body.lock());
+ if(connection_body == 0)
+ {
+ // Make _blocker non-empty so the blocking() method still returns the correct value
+ // after the connection has expired.
+ _blocker.reset(static_cast<int*>(0));
+ return;
+ }
+ _blocker = connection_body->get_blocker();
       }
       void unblock()
       {
@@ -40,7 +46,8 @@
       }
       bool blocking() const
       {
- return _blocker != 0;
+ shared_ptr<void> empty;
+ return _blocker < empty || empty < _blocker;
       }
     private:
       boost::weak_ptr<detail::connection_body_base> _weak_connection_body;


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