ExCons


code

cworkers = 10;
count = 10;
res = 0;

SocketChannel chan;

con i = 1 to cworkers do
  Consumer(i);
end

Consumer(i) {
  s = 0;
  for i = 1 to count do
    get val from chan;
    s += val;
  end

  atomic res += s; end
}

java source code