atomicUpdateSlot

fun atomicUpdateSlot(    field: ObjectSlotsEnum,     subscript: Int = 1,     updater: AvailObject.() -> A_BasicObject): AvailObject

Extract the current value of the indexable object slot, pass it to the supplied Kotlin function, and write the result back to the slot with a compare-and-set, retrying from the beginning if it fails.

Return

The object that was eventually successfully written.

Parameters

field

The indexable AvailObject slot to access.

subscript

The one-based subscript within the given indexable field.

updater

The transformation to perform on the AvailObject in the slot to produce a replacement A_BasicObject. Note that this may run multiple times if the compare-and-set encounters contention.


fun atomicUpdateSlot(    field: IntegerSlotsEnum,     subscript: Int = 1,     updater: Long.() -> Long): Long

Extract the current value of the indexable Long slot, pass it to the supplied inline Kotlin function, and write the result back to the slot with a compare-and-set, retrying from the beginning if it fails.

Parameters

field

The indexable Long slot to access.

subscript

The optional one-based subscript within the given indexable field. Should be 1 for a non-repeating field.

updater

The transformation to perform on the Long in the slot to produce a replacement Long. Note that this may run multiple times if the compare-and-set encounters contention.