How Stop Worker Thread if Owner Thread is Finished?
marcone at email.com
Tue Oct 27 13:56:04 UTC 2020
On Tuesday, 27 October 2020 at 12:16:01 UTC, Rene Zwanenburg
> 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
isDaemon: A daemon thread is automatically terminated when all
non-daemon threads have terminated.
More information about the Digitalmars-d-learn