Bug 10976 – thread_joinAll after main exit performed too late

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-05T19:49:00Z
Last change time
2013-10-08T09:47:14Z
Keywords
pull
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2013-09-05T19:49:33Z
Because we moved the rt_init/rt_term code into the .ctors/.dtors of druntime the implicit thread_joinAll is called too late, i.e. after the shared static destructors are run. This might crash or hang other running threads. https://github.com/D-Programming-Language/druntime/pull/590
Comment #1 by code — 2013-09-05T23:16:24Z
Comment #2 by github-bugzilla — 2013-09-17T06:15:40Z
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/7d82a57c82f9a5359468680f36aa1026243e6f9e fix Issue 10976 - thread_joinAll after main exit performed too late - Move thread_joinAll out of rt_term and call it immediately after exiting from main instead. - Make it an error to call rt_term when other non-daemon threads are still running. - It was not a good idea to call thread_joinAll in rt_term because with DLLs threads could have been attached and outlive the runtime. - As a side effect it will be called before `static ~this()` of the main thread is run. https://github.com/D-Programming-Language/druntime/commit/db772968244bf5af37a81060758a1f266e0b698f Merge pull request #600 from dawgfoto/fix10976 fix Issue 10976 - thread_joinAll after main exit performed too late
Comment #3 by braddr — 2013-10-06T20:29:28Z
Anything left to fix or should this bug be closed?