digitalmars.D.bugs - [Issue 2439] New: static ~this() cannot be used to shutdown threads
- d-bugmail puremagic.com (20/20) Nov 02 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2439
- d-bugmail puremagic.com (14/14) Nov 02 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2439
- =?ISO-8859-15?Q?S=F6nke_Ludwig?= (3/24) Nov 03 2008 Ah OK.. I didn't know about that property. That approach is definitly
http://d.puremagic.com/issues/show_bug.cgi?id=2439 Summary: static ~this() cannot be used to shutdown threads Product: D Version: 2.020 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: ludwig informatik.uni-luebeck.de In src/druntime/src/compiler/dmd/dmain2.d:301 thread_joinAll() is called before _moduleDtor(). This makes it impossible to perform thread shutdown inside of a module destructor because the thread_joinAll() call will wait indefinitely if there are still threads waiting for a shutdown signal. Moving thread_joinAll between _moduleDtor() and gc_term() should fix the issue. (not sure if this should go here or into the trac issue tracker for druntime...) --
Nov 02 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2439 sean invisibleduck.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX It's not unlikely that a thread may depend on static data, so by moving thread_joinAll() until after the module dtors are called we would be pulling the rug out from under these threads. Instead, I suggest making threads that interact with the module shutdown process into daemon threads by using the "isDaemon" property. These threads are ignored during thread_joinAll() and, left alone, will run until the process ends. --
Nov 02 2008
d-bugmail puremagic.com schrieb:http://d.puremagic.com/issues/show_bug.cgi?id=2439 sean invisibleduck.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX It's not unlikely that a thread may depend on static data, so by moving thread_joinAll() until after the module dtors are called we would be pulling the rug out from under these threads. Instead, I suggest making threads that interact with the module shutdown process into daemon threads by using the "isDaemon" property. These threads are ignored during thread_joinAll() and, left alone, will run until the process ends.Ah OK.. I didn't know about that property. That approach is definitly workable, albeit maybe a little non-obvious. THanks for the quick feedback.
Nov 03 2008