can't understand why code do not working

kiran kumari via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 24 00:03:38 PDT 2014


On Monday, 22 September 2014 at 19:36:39 UTC, Suliman wrote:
> Already 1 hour I am looking at example from 
> http://ddili.org/ders/d.en/concurrency.html and my modification 
> of it, and can't understand what's difference? Why it's output 
> only:
> 1
> 3
>
> and then do not do nothing!
>
> import std.stdio;
> import std.concurrency;
> import core.thread;
>
>
> void main()
> {
>    Tid wk = spawn(&worker);
>    foreach(v; 1..5)
>    {
>     wk.send(v);
>     int result = receiveOnly!int();
>     writeln(result);
>    }
> }
see more example
http://techgurulab.com/course/java-quiz-online/
>
> void worker()
> {
>     int value = 0;
>     value = receiveOnly!int();
>     writeln(value);
>     int result = value * 3;
>     ownerTid.send(result);
> }

see more example
http://techgurulab.com/course/java-quiz-online/


More information about the Digitalmars-d-learn mailing list