Class KQueue::Watcher
In: lib/rb-kqueue/watcher.rb
lib/rb-kqueue/watcher/process.rb
lib/rb-kqueue/watcher/file.rb
lib/rb-kqueue/watcher/socket_read_write.rb
lib/rb-kqueue/watcher/signal.rb
lib/rb-kqueue/watcher/read_write.rb
lib/rb-kqueue/watcher/timer.rb
Parent: Object

Watchers monitor for a single sort of event, specified by the specific subclass and its parameters. A watcher is usually created via one of the `watch_*` methods on {Queue}.

One {Queue} may have many {Watcher}s. The Queue actually takes care of the checking for events, via \{Queue#run run} or \{Queue#process process}.

Watcher objects themselves have several useful capabilities. Each subclass keeps track of its own specific information. In addition, all Watchers can be \{delete! deleted from the queue}, \{add! added back in}, \{disable! disabled}, and \{enable! enabled}.

Methods

add!   callback!   delete!   disable!   enable!   new  

Classes and Modules

Class KQueue::Watcher::File
Class KQueue::Watcher::Process
Class KQueue::Watcher::ReadWrite
Class KQueue::Watcher::Signal
Class KQueue::Watcher::SocketReadWrite
Class KQueue::Watcher::Timer

Attributes

queue  [R]  The {Queue} that created this Watcher.

@return [Queue]

Public Class methods

Creates a new Watcher.

@private @param queue [Queue] The queue for which this watcher will be used. @param ident [Fixnum] The underlying kqueue identifier for this watcher. @param filter [Symbol] The name of the underlying kqueue filter for this watcher. @param fflags [Array<Symbol>] Filter-specific flags. @param data [Fixnum] Filter-specific data. @param callback [Proc{Event -> void}] The callback that will be called

  on any events fired by this watcher.

@raise [SystemCallError] If something goes wrong when registering this Watcher.

Public Instance methods

Adds this Watcher to \{queue its Queue}. Note that this is done automatically when the Watcher is created.

@raise [SystemCallError] If something goes wrong when adding this Watcher. @return [void]

Calls this Watcher‘s callback with the given {Event}.

@private @param event [Event] @return [void]

Removes this Watcher from \{queue its Queue}. This means that events won‘t be fired or even checked for.

@raise [SystemCallError] If something goes wrong when deleting this Watcher. @return [void]

Disables this Watcher. This means that events won‘t be fired, but they‘ll still be checked for.

@raise [SystemCallError] If something goes wrong when enabling this Watcher. @return [void]

Enables this Watcher. Note that this is done automatically when the Watcher is created, as well as whenever \{add!} is called.

@raise [SystemCallError] If something goes wrong when enabling this Watcher. @return [void]

[Validate]