Boost logo

Boost Users :

From: Timmo Stange (ts_at_[hidden])
Date: 2007-02-18 13:08:55


Frank Mori Hess wrote:

> On Sunday 18 February 2007 12:08 am, Gottlob Frege wrote:
>> - do you hold any locks DURING the slot call? That's typically bad,
>> since you have no idea what else is locked or what a slot might do, so
>> deadlocks abound.
>
> Well, neither implementation will deadlock, except for lock-ordering
> problems between external mutexes and the ones inside the signals
> implementation. I've got a list lock and a slot lock, and only the slot
> lock is held while the slot is executing. I took care that it is safe to
> do a blocking lock on the list lock while a slot lock is already held, and
> the slot lock itself is recursive so I don't see any deadlocks.

Consider two slots which will mutually disconnect the other in a
situation of concurrent signal invocation. With each thread holding
the lock of either slot (because of the invocation), neither would
be able to disconnect the other - a deadlock.

My implementation can similarly deadlock when two signals are involved.

Regards

Timmo Stange


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net