Thread pools

Alex Parrill via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 22 08:41:04 PDT 2015


On Wednesday, 22 July 2015 at 14:28:48 UTC, Chris wrote:
> What would be the best way to manage different threads (spawned 
> via std.concurrency), e.g. to tell them to stop at once, once a 
> new command comes in? A thread pool? How would that look like 
> in D? I feel my knowledge of D threads is still a bit limited.

`std.parallelism` includes a TaskPool class [1] and a taskPool 
property [2], but they spawn their own threads.

I'm not sure why you need a thread pool to tell std.concurrency 
threads to stop; why not send a stop message to each of them?

[1]: http://dlang.org/phobos/std_parallelism.html#.TaskPool
[2]: http://dlang.org/phobos/std_parallelism.html#.taskPool


More information about the Digitalmars-d-learn mailing list