class Concurrent::AtomicMarkableReference

def try_update

Returns:
  • (Array) - the new value and marked state, or nil if

Other tags:
    Yieldparam: old_mark - the starting state of marked
    Yieldparam: old_val - the starting value of the atomic reference

Other tags:
    Yield: - Calculate a new value and marked state for the atomic
def try_update
  old_val, old_mark = reference
  new_val, new_mark = yield old_val, old_mark
  return unless compare_and_set old_val, new_val, old_mark, new_mark
  immutable_array(new_val, new_mark)
end