- Index
- »
- concurrent
- »
- AtomicRef
type
AtomicRef
@Js
const class AtomicRef : Obj
AtomicRef is used to manage a object reference shared between actor/threads with atomic updates. Only immutable objects may be shared.
constructors
| make |
Construct with initial value. |
|---|
fields
| val |
The current value. |
|---|
methods
| compareAndSet |
Atomically set the value to |
|---|---|
| getAndSet |
Atomically set the value and return the previous value. |
| toStr |
Return |
Slot Details
compareAndSet
getAndSet
make
new make(Obj? val := null)
Construct with initial value. Throw NotImmutableErr if initialized to a mutable value.
toStr
virtual override Str toStr()
Return val.toStr
val
Obj? val
The current value. Throw NotImmutableErr if set to a mutable value.