Thread pools

Chris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 23 01:51:35 PDT 2015


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 cleanly terminate itself when 
> instructed, so you just send a terminate message down the tree 
> of threads and then wait for the effects to bubble back up to 
> main.

Thanks. I was thinking the same when I gave it a second thought 
on my way home. Instead of having a central pool, every thread is 
responsible for its own threads. So main only needs to care about 
the initial thread. That's the theory, I'll have to see how this 
works in reality.


More information about the Digitalmars-d-learn mailing list