How to implement Canceleable spawn() from parent
Ali Çehreli
acehreli at yahoo.com
Tue Jun 30 00:33:41 UTC 2020
On 6/29/20 4:34 PM, aberba wrote:
> So with this, without the Thread.sleep() to block main from exiting, the
> spawned thread will terminate immediately.
You can call core.thread.thread_joinAll at the end of main.
Another way would be to wait for a worker's exit by looking for
LinkTerminated but you need to start the thread with spawnLinked:
http://ddili.org/ders/d.en/concurrency.html#ix_concurrency.LinkTerminated
Ali
More information about the Digitalmars-d-learn
mailing list