What wrong?
anonymous via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 4 05:19:26 PDT 2015
On Monday, 4 May 2015 at 08:48:47 UTC, Fyodor Ustinov wrote:
> Simple code:
>
> http://pastebin.com/raw.php?i=7jVeMFXQ
>
> This code works compiled by DMD v2.066.1 and LDC2 (0.15.1) based
> on DMD v2.066.1 and LLVM 3.5.0.
>
> $ ./z
> TUQLUE
> 42
> 11
>
> Compiled by DMD v2.067.1 the program crashes:
> $ ./aa
> TUQLUE
> Segmentation fault
>
> What I'm doing wrong?
Reduced it a little:
----
module z;
import std.stdio;
import std.concurrency;
import core.thread;
struct Variant {
void function() fptr = &handler;
static void handler() {}
~this() {
fptr();
}
}
void _get(Tid id) {
id.send(Variant());
}
void supervisor() {
receive(&_get);
}
void main() {
Tid supervisorTid = spawn(&supervisor);
supervisorTid.send(thisTid);
writeln("TUQLUE");
receive(
(Variant a) {}
);
writeln("42");
thread_joinAll();
}
----
More information about the Digitalmars-d
mailing list