On 2010-08-27 12:53:07 -0400, Gabriel Huau <[email protected]> said:

void main()
{
        Foo l = new Foo();
        void delegate() dg;

        dg = &l.test;
        auto a = spawn(dg);

        a.send("test");
}

I have tested and it worked.

But by passing the this pointer of your Foo object to another thread, you've broken the rules about sharing memory between threads.

If Foo was a shared or synchronized type, then this could be made to work safely (with some adaptation to make the compiler aware of what delegates can be safely shared.)


--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to