Method: Concurrent::AtomicDirectUpdate#update
- Defined in:
- lib/concurrent/atomic_reference/direct_update.rb
#update {|Object| ... } ⇒ Object
Pass the current value to the given block, replacing it with the block’s result. May retry if the value changes during the block’s execution.
19 20 21 22 |
# File 'lib/concurrent/atomic_reference/direct_update.rb', line 19 def update true until compare_and_set(old_value = get, new_value = yield(old_value)) new_value end |