On 10/17/2012 11:29 PM, Joshua Niehus wrote:
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
I am not sure whether it is supposed to be, but the function must be a
module-level function; so define it outside of main.
When I did that, there was segmentation fault if I used thread priority.
Workaround:
1) Take function out of main
2) Do not specify thread priority
Created bug report:
http://d.puremagic.com/issues/show_bug.cgi?id=8849
Ali