[Issue 11492] Executable with thread termination crashes (worked in 2.63, works on Windows)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 12 03:16:57 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11492


Atila Neves <atila.neves at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |


--- Comment #5 from Atila Neves <atila.neves at gmail.com> 2013-11-12 03:16:52 PST ---
This example from TDPL (the only difference is the std.exception import for
enforce) also results in a binary that crashes when compiling with dmd 2.064.2:

import std.concurrency, std.stdio, std.exception;

void main() {
    auto low = 0, high = 100;
    auto tid = spawn(&fun, low, high);
    foreach(i; low .. high) {
        writeln("Main thread: ", i);
        tid.send(thisTid, i);
        enforce(receiveOnly!Tid() == tid);
    }
}

void fun(int low, int high) {
    for(;;) {
        auto msg = receiveOnly!(Tid, int)();
        writeln("Secondary thread: ", msg[1]);
        msg[0].send(thisTid);
    }
}

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


More information about the Digitalmars-d-bugs mailing list