On Tuesday, 27 October 2020 at 12:16:01 UTC, Rene Zwanenburg
wrote:
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
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
I want to use isDaemon to automatic stop worker thread if ownner
thread is finished
On Tuesday, 27 October 2020 at 08:33:36 UTC, Johann Lermer wrote:
or you could use the fact, that receiveTimeout throws an
exception, when main ends (although I don't know if this is the
intended behaviour; the manual just says that it throws an
exception when the sending thread was terminated)
You could tell your thread via a shared variable that main has
ended:
import std.stdio;
import std.concurrency;
import core.thread;
shared bool end = false;
void thread ()
{
for (;;)
{
Thread.sleep (500.msecs);
synchronized
{
On Tuesday, 27 October 2020 at 00:46:48 UTC, Marcone wrote:
Because when the main thread is completed the worker thread
continues to run.
Please provide a code example. It's much easier to reason about.
Are you creating a thread from a thread and want the 2nd spawned
thread to be terminated w
Because when the main thread is completed the worker thread
continues to run.