class Concurrent::MVar

def modify(timeout = nil)

Returns:
  • (Object) - the transformed value, or `TIMEOUT`
def modify(timeout = nil)
  raise ArgumentError.new('no block given') unless block_given?
  @mutex.synchronize do
    wait_for_full(timeout)
    # If we timed out we'll still be empty
    if unlocked_full?
      value = @value
      @value = yield value
      @full_condition.signal
      apply_deref_options(value)
    else
      TIMEOUT
    end
  end
end