class Concurrent::AtomicMarkableReference
def try_update!
-
(Concurrent::ConcurrentUpdateError)
- if the update fails
Returns:
-
(Array)
- the new value and marked state
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 unless compare_and_set old_val, new_val, old_mark, new_mark fail ::Concurrent::ConcurrentUpdateError, 'AtomicMarkableReference: Update failed due to race condition.', 'Note: If you would like to guarantee an update, please use ' + 'the `AtomicMarkableReference#update` method.' end immutable_array(new_val, new_mark) end