with Write Reactors To Modify
open override fun <T> withWriteReactorsToModify( self: AvailObject, toModify: Boolean, body: (MutableMap<A_Atom, VariableDescriptor.VariableAccessReactor>?) -> T): T
Content copied to clipboard
Extract the given variable's write-reactors map, and pass it into the body function. If toModify is true, initialize the field if needed. If toModify is false and the field has not yet been set, use null instead. Ensure that the map can not be read or written by other threads during the body.
Use a lock on the write-reactors map itself, to ensure atomicity. If the map is null (and therefore toModify was false), don't lock anything.
Parameters
T
The type of value produced by the body and returned by this method.
self
The A_Variable to examine and/or update.
to Modify
Whether to initialize the field if it has not yet been initialized.
body
A function that runs with either this variable's MutableMap from A_Atom to VariableDescriptor.VariableAccessReactor, or null.