getAndSetValue

abstract fun getAndSetValue(newValue: A_BasicObject): AvailObject

Read the variable's value and set it to the new value. Answer the old value. Fail if the new value is not suitable for the variable, or if the variable had no value. Ensure that the entire operation runs atomically with respect to other reads and writes of the variable. Use information about whether the variable is potentially shared between Avail fibers to determine whether locking operations are needed.

Return

The previous value of the variable.

Parameters

newValue

The value to assign.

Throws

If the current value could not be read, e.g., because the variable is unassigned.

If the new value is incorrectly typed.