[dmd-concurrency] Shutdown protocol
Sean Kelly
sean at invisibleduck.org
Tue Feb 9 09:42:14 PST 2010
On Jan 21, 2010, at 12:37 PM, Andrei Alexandrescu wrote:
> Sean Kelly wrote:
>> On Jan 21, 2010, at 12:26 PM, Steve Schveighoffer wrote:
>>> If a thread has exited, it takes probably a few hundred cycles to return, probably not 100ms. If it has not exited, no amount of parallelism is going to save you from waiting for the thread to exit.
>>>
>>> A join sends no messages or anything, it simply waits until the thread has exited and deposited it's return code, then returns the return code. While you are joining a slow-to-exit thread, all your other threads have exited, so in essence the parallelism occurs because the broadcast of the shutdown gets all the threads ready to be joined. I don't see any benefit to joinAll (except to avoid having to write a loop).
>> It might certainly be useful to have a join() routine with a timeout. But to support that universally we'd have to roll our own, and coordinate using an event variable.
>
> Yah, join(timeout) would be great.
Alrighty. Let me know if this should be a pre-TDPL thing. It will mean a shared mutex and condvar for each thread I think.
More information about the dmd-concurrency
mailing list