Fantom

 

const final class

concurrent::AtomicRef

sys::Obj
  concurrent::AtomicRef

AtomicRef is used to manage a object reference shared between actor/threads with atomic updates. Only immutable objects may be shared.

Slots

compareAndSetSource

native Bool compareAndSet(Obj? expect, Obj? update)

Atomically set the value to update if current value is equivalent to the expect value compared using === operator. Return true if updated, or false if current value was not equal to the expected value. Throw NotImmutableErr if val is mutable.

getAndSetSource

native Obj? getAndSet(Obj? val)

Atomically set the value and return the previous value. Throw NotImmutableErr if val is mutable.

makeSource

new make(Obj? val := null)

Construct with initial value. Throw NotImmutableErr if initialized to a mutable value.

toStrSource

override Str toStr()

Overrides sys::Obj.toStr

Return val.toStr

valSource

native Obj? val

The current value. Throw NotImmutableErr if set to a mutable value.