Sha256: b3f61cae70860671ea889d5f43df2778e57b4e8099e547dccbef0622cd1e8af7

Contents?: true

Size: 665 Bytes

Versions: 3

Compression:

Stored size: 665 Bytes

Contents

require 'celluloid/io/waker'
require 'celluloid/io/reactor'
require 'celluloid/io/mailbox'

module Celluloid
  # Actors which can run alongside other I/O operations
  module IO
    def self.included(klass)
      klass.send :include, ::Celluloid
      klass.use_mailbox Celluloid::IO::Mailbox
    end

    # Wait for the given IO object to become readable
    def wait_readable(io, &block)
      # Law of demeter be damned!
      current_actor.mailbox.reactor.wait_readable(io, &block)
    end

    # Wait for the given IO object to become writeable
    def wait_writeable(io, &block)
      current_actor.mailbox.reactor.wait_writeable(io, &block)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
celluloid-0.6.2 lib/celluloid/io.rb
celluloid-0.6.1 lib/celluloid/io.rb
celluloid-0.6.0 lib/celluloid/io.rb