Monday, February 8, 2010

Atomics

A fairly rudimentary AtomicInt type:

def testAtomicInt {
  var a = AtomicInt32(0);
  assertFalse(a.cas(1, 1));
  assertEq(0, a.value);
  assertTrue(a.cas(0, 1));
  assertEq(1, a.value);
}

No comments:

Post a Comment