Combining Unique type with concurrency module

Alex via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 14 23:39:52 PDT 2015


On Monday, 14 September 2015 at 08:08:35 UTC, Ali Çehreli wrote:
> void main()
> {
>     MultiThreadedUnique!S u1 = produce();
>     auto childTid2 = spawn(&spawnedFunc2, thisTid);
>
>     u1.giveTo(childTid2);
>     send(childTid2, cast(shared(MultiThreadedUnique!S*))&u1);
>
>     import core.thread;
>     thread_joinAll();
>
>     writeln("Successfully printed number.");
>     auto u2 = &u1.get();
> }
>
> Ali

ok... I tried the code. It works well in the first approach... 
But I have to think about it some more time... Thanks again!


More information about the Digitalmars-d-learn mailing list