std.parallelism: How to wait all tasks finished?
Cooler
kulkin at hotbox.ru
Sun Feb 2 16:00:37 PST 2014
I have several tasks. Each task may or may not create another
task. What is the best way to wait until all tasks finished?
The code:
void procData(){
if(...)
taskPool.put(task(&procData));
}
void main(){
taskPool.put(task(&procData));
taskPool.put(task(&procData));
...
taskPool.put(task(&procData));
// 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);
}
More information about the Digitalmars-d-learn
mailing list