Hi folks,

I need to create thread and pass to it array of objects wich will no longer use in main thread.

The problem is that spawn only accepts immutables and i have no idea how to tell him that i transfer full ownership of the data to child thread.

  the code:

import std.concurrency;

class Foo
{

}

void worker( Foo[] data )
{
        //...
}

void main()
{
        auto data = new Foo[10];
        spawn( &worker, data );
}


P.S. I do need to create data in main thread and distribute it to child threads.

--
BR, Ruslan Mullakhmetov

Reply via email to