Re: std.parallelism: How to wait all tasks finished?

2014-02-06 Thread Russel Winder
On Mon, 2014-02-03 at 00:00 +, Cooler wrote: > I have several tasks. Each task may or may not create another > task. What is the best way to wait until all tasks finished? What you are describing here is a classic fork/join architecture. The tasks are structured as a tree with synchronization

Re: std.parallelism: How to wait all tasks finished?

2014-02-06 Thread Andrea Fontana
On Thursday, 6 February 2014 at 16:07:51 UTC, Andrea Fontana wrote: On Thursday, 6 February 2014 at 14:52:36 UTC, Cooler wrote: On Thursday, 6 February 2014 at 14:42:57 UTC, Cooler wrote: On Thursday, 6 February 2014 at 11:30:17 UTC, Andrea Fontana wrote: On Wednesday, 5 February 2014 at 15:38

Re: std.parallelism: How to wait all tasks finished?

2014-02-06 Thread Andrea Fontana
On Thursday, 6 February 2014 at 14:52:36 UTC, Cooler wrote: On Thursday, 6 February 2014 at 14:42:57 UTC, Cooler wrote: On Thursday, 6 February 2014 at 11:30:17 UTC, Andrea Fontana wrote: On Wednesday, 5 February 2014 at 15:38:14 UTC, Cooler wrote: On Tuesday, 4 February 2014 at 03:26:04 UTC, D

Re: std.parallelism: How to wait all tasks finished?

2014-02-06 Thread Andrea Fontana
On Wednesday, 5 February 2014 at 15:38:14 UTC, Cooler wrote: On Tuesday, 4 February 2014 at 03:26:04 UTC, Dan Killebrew wrote: It seems to me that worker threads will continue as long as the queue isn't empty. So if a task adds another task to the pool, some worker will process the newly enqueu

Re: std.parallelism: How to wait all tasks finished?

2014-02-05 Thread Chris Williams
On Wednesday, 5 February 2014 at 15:38:14 UTC, Cooler wrote: Will not help. I don't know beforehand what tasks will be created. procData is recursive and it decides create new task or not. You seem to be saying that you want to be able to wait for all tasks to complete an indefinite number of

Re: std.parallelism: How to wait all tasks finished?

2014-02-03 Thread Dan Killebrew
It seems to me that worker threads will continue as long as the queue isn't empty. So if a task adds another task to the pool, some worker will process the newly enqueued task. No. After taskPool.finish() no way to add new tasks to the queue. taskPool.put will not add new tasks. Then perhaps

Re: std.parallelism: How to wait all tasks finished?

2014-02-02 Thread Dan Killebrew
// Next line will block execution until all tasks already in queue finished. // Almost all what I need, but new tasks will not be started. taskPool.finish(true); } Are you sure TaskPool.finish isn't what you're looking for? "Signals worker threads to terminate when the queue becomes emp