[dmd-concurrency] Shutdown protocol
Andrei Alexandrescu
andrei at erdani.com
Thu Jan 21 12:22:26 PST 2010
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.
Andrei
More information about the dmd-concurrency
mailing list