std.concurrency msg passing

Sean Kelly sean at invisibleduck.org
Thu Oct 18 11:31:04 PDT 2012


On Oct 17, 2012, at 11:29 PM, Joshua Niehus <jm.niehus at 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 = receiveTimeout(dur!"seconds"(10), (int isInt) {
>        writeln("I should not be here");
>    });

spawn() shouldn't allow you to spawn a delegate.  Last I checked (which was admittedly a while ago), there were some compiler issues around actually verifying the function signature sent to spawn() though.


More information about the Digitalmars-d-learn mailing list