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);
}
}
void worker()
{
int value = 0;
value = receiveOnly!int();
writeln(value);
int result = value * 3;
ownerTid.send(result);
}