class Atomic
source · line 5public
public class Atomic<T: value> public constructor(initial: T)
A lock-protected cell for any value type, including values containing managed references. Operations copy the whole value under the cell lock.
function store
source · line 32public
public fun store(value: T): Unit
Replaces the whole value while holding the cell lock.
parameter value
source · line 32public
value: T
function exchange
source · line 51public
public fun exchange(value: T): T
Replaces the value under one lock acquisition and returns the previous value.
parameter value
source · line 51public
value: T
constructor constructor
source · line 5public
constructor(initial: T)
parameter initial
source · line 5public
initial: T
function load
source · line 12public
public fun load(): T
Copies the stored value while holding the cell lock.
type parameter T
source · line 5public
T: value