So, I am probably overlooking something obvious, but here goes:
According to my understanding of daemon threads and what is
documented here[1],
this following program should terminate once the druntime shuts
down, as the thread working on the task is supposed to be a
daemon thread:
import std.parallelism;
void main()
{
taskPool.put(task({ while(true) {} }));
}
The actual behaviour (with dmd 2.071 and ldc2 1.0.0), however, is
that the program keeps running.
In contract, this behaves as expected:
import core.thread;
void main()
{
with (new Thread({ while(true) {} })) {
isDaemon = true;
start();
}
}
Commenting out setting the isDaemon property will achieve the
same behaviour as the taskPool example. Is this the intended
behaviour of taskPool (because it does have isDaemon set)?
[1] https://dlang.org/library/std/parallelism/task_pool.html