std.concurrency msg passing

2012-10-18 Thread Joshua Niehus
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

Re: std.concurrency msg passing

2012-10-18 Thread cal
On Thursday, 18 October 2012 at 06:30:08 UTC, 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 =

Re: std.concurrency msg passing

2012-10-18 Thread Ali Çehreli
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) {

Re: std.concurrency msg passing

2012-10-18 Thread Sean Kelly
On Oct 17, 2012, at 11:29 PM, Joshua Niehus jm.nie...@gmail.com 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 =

Re: std.concurrency msg passing

2012-10-18 Thread cal
On Thursday, 18 October 2012 at 18:31:09 UTC, Sean Kelly wrote: On Oct 17, 2012, at 11:29 PM, Joshua Niehus void foo(Tid tid) { send(tid, true); } /* snip */ spawn() shouldn't allow you to spawn a delegate. Last I checked (which was admittedly a while ago), there were some compiler

Re: std.concurrency msg passing

2012-10-18 Thread Sean Kelly
On Oct 18, 2012, at 11:35 AM, cal callumena...@gmail.com wrote: On Thursday, 18 October 2012 at 18:31:09 UTC, Sean Kelly wrote: On Oct 17, 2012, at 11:29 PM, Joshua Niehus void foo(Tid tid) { send(tid, true); } /* snip */ spawn() shouldn't allow you to spawn a delegate. Last I checked

Re: std.concurrency msg passing

2012-10-18 Thread Joshua Niehus
On Thursday, 18 October 2012 at 17:33:04 UTC, cal wrote: I can't see the bug? The receiver accepts a bool as an int, same way a normal function does. The timeout is long enough that foo gets a chance to send. If you want to stop the int receiver getting a bool, you could add another receiver