class Concurrent::AbstractExchanger

def exchange(value, timeout = nil)

Returns:
  • (Object) - the value exchanged by the other thread or `nil` on timeout

Parameters:
  • timeout (Numeric, nil) -- in seconds, `nil` blocks indefinitely
  • value (Object) -- the value to exchange with another thread
def exchange(value, timeout = nil)
  (value = do_exchange(value, timeout)) == CANCEL ? nil : value
end