const class std::AtomicInt
sys::Obj std::AtomicInt
AtomicInt is used to manage an integer variable shared between actor/threads with atomic updates.
- add
-
Atomically add the given value to the current value
- addAndGet
-
Atomically add the given value to the current value and return the updated value.
- compareAndSet
-
Bool compareAndSet(Int expect, Int update)
Atomically set the value to
update
if current value is equivalent to theexpect
value. Return true if updated, or false if current value was not equal to the expected value. - decrement
-
Void decrement()
Atomically decrement the value by one
- decrementAndGet
-
Int decrementAndGet()
Atomically decrement the current value by one and return the updated value.
- getAndAdd
-
Atomically add the given value to the current value and return the previous value.
- getAndDecrement
-
Int getAndDecrement()
Atomically decrement the current value by one and return the previous value.
- getAndIncrement
-
Int getAndIncrement()
Atomically increment the current value by one and return the previous value.
- getAndSet
-
Atomically set the value and return the previous value.
- increment
-
Void increment()
Atomically increment the value by one
- incrementAndGet
-
Int incrementAndGet()
Atomically increment the current value by one and return the updated value.
- make
-
new make(Int val := 0)
Construct with initial value
- toStr
-
virtual override Str toStr()
Return
val.toStr
- val
-
Int val
The current integer value