Class: Farce::Abstract::Exchanger
- Inherits:
-
Object
- Object
- Farce::Abstract::Exchanger
- Includes:
- Internal::Noncopyable, Internal::Inspect
- Defined in:
- lib/farce/abstract/exchanger.rb
Overview
A rendezvous where callers pair up and receive each other's offered value. Each call participates in one exchange. The exchanger can be reused by any number of callers.
Direct Known Subclasses
Instance Method Summary collapse
-
#exchange(offered, timeout: nil) { ... } ⇒ BasicObject?
Wait for a partner and return the partner's value.
Methods included from Internal::Noncopyable
Instance Method Details
#exchange(offered, timeout: nil) { ... } ⇒ BasicObject?
Wait for a partner and return the partner's value. Offering nil allows a caller to receive a value without sending a payload. A timeout of zero only exchanges with a partner that is already waiting. A successful exchange of nil does not invoke the fallback.
23 |
# File 'lib/farce/abstract/exchanger.rb', line 23 def exchange(offered, timeout: nil, &) = @exchanger.exchange(offered, timeout:, &) |