class Concurrent::MVar

def take(timeout = nil)

Returns:
  • (Object) - the value that was taken, or `TIMEOUT`
def take(timeout = nil)
  @mutex.synchronize do
    wait_for_full(timeout)
    # If we timed out we'll still be empty
    if unlocked_full?
      value = @value
      @value = EMPTY
      @empty_condition.signal
      apply_deref_options(value)
    else
      TIMEOUT
    end
  end
end