[Boost-bugs] [Boost C++ Libraries] #8449: Provide swap() and/or move for signals

Subject: [Boost-bugs] [Boost C++ Libraries] #8449: Provide swap() and/or move for signals
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-04-16 13:47:54


#8449: Provide swap() and/or move for signals
------------------------------+---------------------------------------------
 Reporter: andysem | Owner: fmhess
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: signals2
  Version: Boost 1.53.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 Please, provide a member swap() function (and a free swap() overload) for
 signals. Moving support would also be helpful.

 Swapping can be useful to solve deadlock problems in user's code. Consider
 the following example:

 1. We have an object a1 of class A, which contains a signal and a mutex
 for protecting A's internal state.
 2. We have a number of objects b1 - bN of types B1 - BN which subscribe
 for the signal in A.
 3. The signal in a1 is a one-time notification (i.e. it and the a1 object
 itself will be destroyed soon after the notification). When it is invoked,
 the mutex has to be locked to protect the signal from being modified.
 4. The b1 - bN objects may need to call back methods of a1 while being
 notified. These methods may need to lock the mutex in a1 but this would
 lead to a deadlock.

 A typical solution for this problem is to move the signal to stack while
 holding the mutex, then release the mutex and invoke the signal. But this
 is not possible because signals do not allow swapping or moving.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8449>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC