[dmd-concurrency] Shutdown protocol

Andrei Alexandrescu andrei at erdani.com
Thu Jan 21 12:36:48 PST 2010


Windows has WaitForMultipleObjects:

http://msdn.microsoft.com/en-us/library/ms687025%28VS.85%29.aspx

which can be used in a loop as a primitive. Sadly Linux doesn't have that:

http://www.ibm.com/developerworks/linux/library/l-ipc2lin3.html

How about OSX?


Andrei

Sean Kelly wrote:
> 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?
> _______________________________________________
> 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