Module: Concurrent::Promises::FactoryMethods::NewChannelIntegration — Concurrent Ruby

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

Included in:
  Concurrent::Promises::FactoryMethods

Defined in:
  lib-edge/concurrent/edge/promises.rb

## Overview

Note:

Edge Features are under active development and may change frequently.

- Deprecations are not added before incompatible changes.
- Edge version: major is always 0, minor bump means incompatible change, patch bump means compatible change.
- Edge features may also lack tests and documentation.
- Features developed in `concurrent-ruby-edge` are expected to move to `concurrent-ruby` when finalised.

## Instance Method Summary collapse

- #select_channel(*channels) ⇒ Future

  Selects a channel which is ready to be read from.

## Instance Method Details

### #select_channel(*channels) ⇒ `Future`

Selects a channel which is ready to be read from.

Parameters:

- channels (`Channel`)

Returns:

- (`Future`) —

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

    167
    168
    169
    170
    171
    # File 'lib-edge/concurrent/edge/promises.rb', line 167

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