mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-25 22:38:04 +02:00
18 lines
No EOL
296 B
Text
18 lines
No EOL
296 B
Text
// 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;
|
|
} |