[dmd-concurrency] Shutdown protocol

Sean Kelly sean at invisibleduck.org
Thu Jan 21 12:42:45 PST 2010


On Jan 21, 2010, at 12:38 PM, Andrei Alexandrescu wrote:

> Sean Kelly wrote:
>> On Jan 21, 2010, at 12:35 PM, Steve Schveighoffer wrote:
>>> Maybe in the event that the threads exit in the order you join them, but the end result is the main thread resumes immediately after the last thread exits.  Calling join on a finished thread does not require any context switching or messages, it simply returns immediately with the exit code.
>> Yeah exactly.  Joining in a loop shouldn't be noticeably slower than joining all in parallel.
> 
> Not if they want to close sockets gracefully or best-effort-gracefully as in your destructor example. Actually your own destructor example ruins your point because it has a relatively high latency!!!

My dtor example has the problem of sending the signal and then waiting on the connection to close, so you're right.  But I think we're actually saying the same thing regarding joinAll().  What I envision is broadcasting a shutdown message and then looping on join(), not treating each thread as an atomic unit like I do with the connections.


More information about the dmd-concurrency mailing list