On 12/13/2013 03:53 PM, Irving Montalvo wrote:
Socket[ulong] clients;
-----------------------------------main()
ulong index = clients.length;
clients[index] = cli; //<-- Socket cli
send(tid, index)
---------------------------------spawned()
receive(
(ulong i) {
clients[i].send('Hello concurrent'); // Error clients.length is zero
}
);
---------------------------------
Help me please!
Data is thread-local by default. clients are not the same array as seen
by the two threads.
Declare it as 'shared' and pray that you will not have bugs in your
"data-sharing concurrency" app. :)
shared Socket[ulong] clients;
At least I think that's what is happening there. :)
Ali