Signals & Slots

Lutger lutger.blijdestijn at gmail.com
Mon Nov 5 06:00:33 PST 2007


Lars Ivar Igesund wrote:
> Lutger wrote:
...
> Walter claims that the notifyRegister/Unregister method used by among others
> std.signals _are_ threadsafe. If you are using the same methods, can you
> reproduce deadlocks with sslot? It would be nice to have some actual
> evidence in this matter (either way, although I understand that complete
> thread safety may be impossible to prove for an efficient solution).
> 

Hmmm, I remember Walter saying std.signals isn't thread-safe, maybe I;m 
wrong? Sean mentioned the reason the notifyRegister/Unregister methods 
aren't implemented in Tango is the potential for deadlocks.

Here is the deadlock scenario as I understand it:

1) delegate A is stored by notifyRegister (as a weak reference that is).
2) Method B gets a lock
3) Concurrently, Object C is being collected, all threads halt
4) As a result of 3, delegate A is invoked and calls method B
5) deadlock

I'll try to make a case where this happens as proof.






More information about the Digitalmars-d mailing list