There is also a Semaphore and Barrier class:
http://dlang.org/phobos/core_sync_barrier.html
http://dlang.org/phobos/core_sync_semaphore.html
On Thursday, 3 July 2014 at 04:51:07 UTC, Ali Çehreli wrote:
On 07/02/2014 08:29 PM, Puming wrote:
I want to spawn several similar tasks and then wait for all
of them to
complete to go on do some other things
If you don't care about account for each of them individually,
On 07/02/2014 08:29 PM, Puming wrote:
I want to spawn several similar tasks and then wait for all of them to
complete to go on do some other things, like:
[...]
My current workaround is using messages:
I forgot to mention that if message passing is merely a workaround :)
in this case then
On Thursday, 3 July 2014 at 10:25:41 UTC, Bienlein wrote:
There is also a Semaphore and Barrier class:
http://dlang.org/phobos/core_sync_barrier.html
http://dlang.org/phobos/core_sync_semaphore.html
This is probably what I'd do, though both this and thread_joinAll
will only work if you have
Hi,
I want to spawn several similar tasks and then wait for all of
them to complete to go on do some other things, like:
```d
void task(int id)
{
// do the stuff
}
void main()
{
foreach (i; 0..10) {
spawn(task, i);
}
wait(?); // wait for all task to complete
doSomeOtherThings
On 07/02/2014 08:29 PM, Puming wrote:
I want to spawn several similar tasks and then wait for all of them to
complete to go on do some other things
If you don't care about account for each of them individually,
core.thread.thread_joinAll would work. The following program starts two
waves of