[dmd-concurrency] Shutdown protocol

Sean Kelly sean at invisibleduck.org
Thu Jan 21 12:30:32 PST 2010


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

> Sean Kelly wrote:
>> On Jan 21, 2010, at 11:28 AM, Andrei Alexandrescu wrote:
>>> Steve Schveighoffer wrote:
>>>> ----- Original Message ----
>>>>> From: Andrei Alexandrescu <andrei at erdani.com>
>>>>> Steve Schveighoffer wrote:
>>>>>> foreach(tid; tids) {tid.join();}
>>>>> Oh btw that shouldn't be coded like that, it's slow. Must be something like:
>>>>> 
>>>>> joinAll(tids);
>>>>> 
>>>>> so joining is initiated in parallel.
>>>>> 
>>>> What does joinAll do?  I admit I am not too familiar with your proposed API.
>>> The idea is to join on all threads in parallel. Otherwise, if you have N threads, the Nth will become aware you plan to shutdown only after all others have already finished.
>> But joining just waits for the thread, it doesn't tell it anything.  Or am I misunderstanding what join() does in this API?
> 
> join() on one thread waits for the thread. join() on 100 threads waits for 100 threads, not for one thread 100 times.

There's no API call that lets you join more than one thread simultaneously, is there?  So isn't it really the same thing?


More information about the dmd-concurrency mailing list