std.concurrency msg passing

Joshua Niehus jm.niehus at gmail.com
Wed Oct 17 23:29:56 PDT 2012


Is the following snippet a bug?

---
import core.thread;
import std.stdio, std.concurrency;

void foo(Tid tid) {
     send(tid, true);
}

void main() {
     auto fooTid = spawn(&foo, thisTid);
     auto receiveInt = receiveTimeout(dur!"seconds"(10), (int 
isInt) {
         writeln("I should not be here");
     });
}
// output: "I should not be here"
---

If not, is there some way I could achieve 
"receiveOnlyTimeout!(int)(dur, fun);" ?

Thanks,
Josh


More information about the Digitalmars-d-learn mailing list