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