fetchAndAddValue

open override fun fetchAndAddValue(addend: A_Number): A_Number

Read the variable's value, add the addend to it, and store it back into the variable. This sequence of operations is protected by a lock if the variable is potentially shared among multiple Avail FiberDescriptor. Fail if the variable had no value, if the variable's content type is not a subtype of the IntegerRangeTypeDescriptor.extendedIntegers, if the addend is not an extended integer, if the sum of the old value and the addend is undefined (e.g., ∞ plus -∞), or if the sum does not satisfy the variable's VariableTypeDescriptor.o_WriteType. Return the previous value.

It is the client's responsibility to ensure the read type of the variable is a subtype of extended integer.

Return

The previous value of the variable.

Parameters

addend

The value by which to adjust the variable.

Throws

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

If the new value is incorrectly typed.