2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00
LaTeX-examples/documents/Programmierparadigmen/scripts/x10/atomic-example.x10

18 lines
296 B
Text
Raw Normal View History

2014-03-28 11:51:59 +01:00
// push data on concurrent
// list-stack
val node = new Node(data);
atomic {
node.next = head;
head = node;
}
// target defined in
// enclosing scope
atomic def CAS(old:Object, n:Object) {
if (target.equals(old)) {
target = n;
return true;
}
return false;
}