How to implement Canceleable spawn() from parent

Ali Çehreli acehreli at yahoo.com
Wed Jul 1 10:01:53 UTC 2020


On 7/1/20 2:41 AM, aberba wrote:
> On Tuesday, 30 June 2020 at 14:43:40 UTC, Steven Schveighoffer wrote:
>> On 6/30/20 10:15 AM, Simen Kjærås wrote:
>>> [...]
> 
> My thinking is I don't want regular consumers using the package to think 
> about the technicality of thread_joinAll() at all.
> 
> Thinking about putting it in a mixin like:
> 
> mixin KeepRunning;
> 
> Or something

How about main() starts a thread that starts all the other threads? 
Then, thread_joinAll() would go inside the non-main :) thread.

However, Steve is right: When main() exits, all threads will and should 
exit.

Ali



More information about the Digitalmars-d-learn mailing list