I was hoping the below example would display 'hello world' but it only displays 'hello'. Is this a bug in the concurrency lib or am i using it incorrectly?

import std.stdio;
import std.concurrency;

void writer()
{
        try
        {
                while (true)
                {
                        receive((string s){
                                writefln(s);
                        });
                }
        }
        catch (OwnerTerminated ex)
        {
                // die.
        }
}

void sender(Tid writer)
{
        send(writer, "world");
}

void main(string[] args)
{
        auto writer = spawn(&writer);
        send(writer, "hello");
        spawn(&sender, writer);
}

Reply via email to