[Issue 4307] New: spawn()'ed thread doesn't terminate

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 13 18:50:16 PDT 2010


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

           Summary: spawn()'ed thread doesn't terminate
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: torhu at yahoo.com


--- Comment #0 from torhu at yahoo.com 2010-06-13 18:50:11 PDT ---
Using DMD 2.047.

This example hangs after printing '9'.  From reading Andrei's book, my
understanding is that the spawned thread should terminate automatically when
its owner thread terminates.  But that doesn't happen here.

---
import std.concurrency;
import std.stdio;

void f()
{
    for (;;)
    {
        int i = receiveOnly!int();
        writeln(i);
    }
}

void main()
{
    Tid tid = spawn(&f);
    foreach (int i; 0..10)
    {
        send(tid, i);
    }
}
---

-- 
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