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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 18 14:32:18 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4890

           Summary: GC.collect() deadlocks multithreaded program.
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: tomash.brechko at gmail.com


--- Comment #0 from Tomash Brechko <tomash.brechko at gmail.com> 2010-09-18 14:31:41 PDT ---
The following program deadlocks with dmd 2.049 (all the time, though it may be
subject to a race):

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

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

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

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

  //j.sleep(1);

  GC.collect();

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

Uncommenting j.sleep(1); avoids the deadlock.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list