Hi,

I have a struct in a separate thread and want to pass it's address back to the main thread. This is how I think it should work:

import std.concurrency;

struct Env {}

void run ()
{
        shared Env env;
        ownerTid.send (&env);
        for (;;) {}
}

void main ()
{
        spawn (&run);
        auto e = receiveOnly!(shared Env*);
}

but I'm getting an error when main tries to receive the pointer. The error message says:

std.concurrency.MessageMismatch@std/concurrency.d(237): Unexpected message type: expected 'shared(Env*)', got 'shared(test.Env)*'

Now, how can I pass that pointer back to main?

Reply via email to