[Issue 19314] Thread object destruction may result in UB
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Oct 27 00:39:07 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19314
--- Comment #1 from github-bugzilla at puremagic.com ---
Commit pushed to master at https://github.com/dlang/druntime
https://github.com/dlang/druntime/commit/f60eb358ccbc14a1a5fc1774eab505ed0132e999
Fix crash in destructor of detached thread
Fix issue 19314
Expectation is that after thread is detached from druntime, it becomes
responsibility of external environment to terminate it properly (for
example, by calling `join` from C/C++ code).
However, `Thread` object for that thread will still remain and will
eventually be collected by GC. Destructor tries to call `pthread_detach`
unconditionally but it is undefined behaviour if thread was already
joined before (see `man pthread_detach`).
--
More information about the Digitalmars-d-bugs
mailing list