Bug 12812 – Need a way to detach a thread externally when its address is unknown
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-27T17:58:00Z
Last change time
2014-05-27T18:55:27Z
Assigned to
nobody
Creator
sean
Comments
Comment #0 by sean — 2014-05-27T17:58:33Z
The specific use case is with D-fuse, where it's necessary to detach all but the main thread at exit before the GC terminates, or a crash occurs. These threads are managed by the D-fuse library and so there's no opportunity to call thread_detachThis. Add a routine that allows threads to be detached by some other means.
Comment #1 by sean — 2014-05-27T18:00:05Z
There are a few ways of going about this, but I'm going with a new call:
extern (C) void thread_detachInstance(Thread t)
The user can iterate through the active thread list and detach all threads that are not equivalent to Thread.getThis, or according to whatever other rule is appropriate. Perhaps checking the isDaemon flag, since all attached threads are daemons.
Comment #2 by code — 2014-05-27T18:55:27Z
*** This issue has been marked as a duplicate of issue 1085 ***