class Concurrent::AbstractExchanger

def try_exchange(value, timeout = nil)

Returns:
  • (Concurrent::Maybe) - on success a `Just` maybe will be returned with
def try_exchange(value, timeout = nil)
  if (value = do_exchange(value, timeout)) == CANCEL
    Concurrent::Maybe.nothing(Concurrent::TimeoutError)
  else
    Concurrent::Maybe.just(value)
  end
end