On Tuesday, 11 July 2017 at 06:18:44 UTC, Biotronic wrote:
On Monday, 10 July 2017 at 20:03:32 UTC, Igor Shirkalin wrote:
[...]
If DRuntime is not made aware of the thread's existence, the
thread will not be stopped by the GC, and the GC might collect
memory that the thread is referencing on the stack or in non-GC
memory. Anything allocated by the GC would still be scanned.
To inform DRuntime about your thread, you should call
thread_attachThis:
https://dlang.org/phobos/core_thread.html#.thread_attachThis
As pointed out in the documentation of thread_attachThis, you
might also want to call rt_moduleTlsCtor, to run thread local
static constructors. Depending on your usage, this might not be
necessary.
--
Biotronic
Thanks for very useful information!