[Issue 4890] GC.collect() deadlocks multithreaded program.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Sep 4 08:16:34 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=4890

andrea.9940 at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry
             Status|RESOLVED                    |REOPENED
                 CC|                            |andrea.9940 at gmail.com
         Resolution|FIXED                       |---
           Severity|normal                      |regression

--- Comment #10 from andrea.9940 at gmail.com ---
This bug is present in DMD 2.066 on Arch Linux 3.14.17-1-lts x86_64 (GNU libc
2.19).
The code posted originally still deadlocks (and even with j.sleep uncommented,
it never prints a "." which means GC.collect never returns):

import core.thread, core.memory, std.stdio;

class Job : Thread {
 this() {
   super(&run);
 }

 private void run() {
   while (true) write("*");
 }
}

void main() {
 Job j = new Job;
 j.start();

 //j.sleep(dur!"msecs"(1));

 GC.collect();

 while(true) write(".");
}

--


More information about the Digitalmars-d-bugs mailing list