How Stop Worker Thread if Owner Thread is Finished?

Rene Zwanenburg renezwanenburg at
Tue Oct 27 12:16:01 UTC 2020

On Tuesday, 27 October 2020 at 11:36:42 UTC, Marcone wrote:
> I want to use isDaemon to automatic stop worker thread if 
> ownner thread is finished

Terminating threads without properly unwinding the stack is 
generally a very bad idea. Most importantly the destructors of 
stucts on the stack won't run which can cause problems like locks 
not being released.

This isn't specific to D either. For example Raymond Chen writes 
about the TerminateThread function in Windows here:

You should signal the thread somehow that it's time to stop 

More information about the Digitalmars-d-learn mailing list