Module: Concurrent::Promises::FactoryMethods::NewChannelIntegration

Included in:
Concurrent::Promises::FactoryMethods
Defined in:
lib/concurrent/edge/promises.rb

Instance Method Summary (collapse)

Instance Method Details

- (Future) select_channel(*channels)

Selects a channel which is ready to be read from.

Parameters:

Returns:

  • (Future)

    a future which is fulfilled with pair [channel, message] when one of the channels is available for reading



2100
2101
2102
2103
2104
# File 'lib/concurrent/edge/promises.rb', line 2100

def select_channel(*channels)
  probe = Promises.resolvable_future
  channels.each { |ch| ch.pop_for_select probe }
  probe
end