Re: Thread pools

2015-07-23 Thread Chris via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 17:01:52 UTC, Marc Schütz wrote: You can probably simply terminate the main thread, which will send an OwnerTerminated message to all dependent threads. The threads need to `receive()` this message and terminate. Not possible here. Main has to run the all the ti

Re: Thread pools

2015-07-23 Thread Chris via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 16:16:36 UTC, John Colvin wrote: I would send a message to terminate to thread1, which would in turn send a similar message to any threads it has started, wait until they've all stopped (maybe with a time-out), then return. I.e. every thread knows how to cleanl

Re: Thread pools

2015-07-22 Thread via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 16:16:36 UTC, John Colvin wrote: On Wednesday, 22 July 2015 at 15:51:23 UTC, Chris wrote: On Wednesday, 22 July 2015 at 15:41:06 UTC, Alex Parrill wrote: [...] Thanks. I'm dealing with "nested" threads at the moment. main { spawn(thread1) { // Does some

Re: Thread pools

2015-07-22 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 15:51:23 UTC, Chris wrote: On Wednesday, 22 July 2015 at 15:41:06 UTC, Alex Parrill wrote: 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 o

Re: Thread pools

2015-07-22 Thread Chris via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 15:41:06 UTC, Alex Parrill wrote: 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

Re: Thread pools

2015-07-22 Thread Alex Parrill via Digitalmars-d-learn
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