Sha256: bd6bb345a719b55ebfc7660ced83769e737a037c5981cd174da5fe73d5d183c9

Contents?: true

Size: 1.18 KB

Versions: 63

Compression:

Stored size: 1.18 KB

Contents

module KQueue
  class Watcher
    # The {Watcher} subclass for events
    # fired when a stream can be read from or written to
    # (which of these is determined by \{#type}).
    # Read events are watched via {Queue#watch_stream_for_read},
    # and write events are watched via {Queue#watch_stream_for_write}.
    #
    # Note that read and write events for sockets
    # use the {SocketReadWrite} class.
    class ReadWrite < Watcher
      # The Ruby IO object from which the file descriptor was extracted.
      # This is only set if an IO object was used to construct this watcher.
      # Otherwise, it's `nil`.
      #
      # @return [IO, nil]
      attr_reader :io

      # The file descriptor for the stream being watched.
      #
      # @return [Fixnum]
      attr_reader :fd

      # The type of watcher, `:read` or `:write`.
      #
      # @return [Symbol]
      attr_reader :type

      # Creates a new read/write Watcher.
      #
      # @private
      def initialize(queue, fd, type, callback)
        if fd.is_a?(IO)
          @io = fd
          fd = fd.fileno
        end

        @fd = fd
        @type = type
        super(queue, @fd, type, [], nil, callback)
      end
    end
  end
end

Version data entries

63 entries across 55 versions & 8 rubygems

Version Path
rb-kqueue-0.2.8 lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/rb-kqueue-0.2.7/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/gems/rb-kqueue-0.2.7/lib/rb-kqueue/watcher/read_write.rb
rb-kqueue-0.2.7 lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/rb-kqueue-0.2.6/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb
rb-kqueue-0.2.6 lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/read_write.rb