Sha256: 08dfa4329c47b88cc0c9501f4a746e0e5e153cf3be7f43ee5c36834671cb0774

Contents?: true

Size: 440 Bytes

Versions: 17

Compression:

Stored size: 440 Bytes

Contents

# frozen_string_literal: true

require_relative '../../polyphony'

module Polyphony
  # Implements a unidirectional communication channel along the lines of Go
  # (buffered) channels.
  class Channel < Polyphony::Queue
    alias_method :receive, :shift

    # Closes the channel, resuming any fibers waiting on the channel with
    # a Polyphony::MoveOn exception
    def close
      flush_waiters(Polyphony::MoveOn.new)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
polyphony-1.6 lib/polyphony/core/channel.rb
polyphony-1.5 lib/polyphony/core/channel.rb
polyphony-1.4 lib/polyphony/core/channel.rb
polyphony-1.3 lib/polyphony/core/channel.rb
polyphony-1.2.1 lib/polyphony/core/channel.rb
polyphony-1.2 lib/polyphony/core/channel.rb
polyphony-1.1.1 lib/polyphony/core/channel.rb
polyphony-1.1 lib/polyphony/core/channel.rb
polyphony-1.0.2 lib/polyphony/core/channel.rb
polyphony-1.0.1 lib/polyphony/core/channel.rb
polyphony-1.0 lib/polyphony/core/channel.rb
polyphony-0.99.6 lib/polyphony/core/channel.rb
polyphony-0.99.5 lib/polyphony/core/channel.rb
polyphony-0.99.4 lib/polyphony/core/channel.rb
polyphony-0.99.3 lib/polyphony/core/channel.rb
polyphony-0.99.2 lib/polyphony/core/channel.rb
polyphony-0.99.1 lib/polyphony/core/channel.rb