[dmd-concurrency] Shutdown protocol

Andrei Alexandrescu andrei at erdani.com
Tue Feb 9 09:43:30 PST 2010


It doesn't need to be pre-TDPL because TDPL does not explain the details 
of how shutdown is carried.

Andrei

Sean Kelly wrote:
> 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.
> _______________________________________________
> dmd-concurrency mailing list
> dmd-concurrency at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-concurrency


More information about the dmd-concurrency mailing list