Class | IO::Reactor |
In: |
lib/facet/io-reactor.rb
|
Parent: | Object |
An object-oriented multiplexing asynchronous IO reactor class.
Version | = | /([\d\.]+)/.match( %q{$Revision: 1.13 $} )[1] | Class constants | |
Rcsid | = | %q$Id: reactor.rb,v 1.13 2003/08/04 23:56:14 deveiant Exp $ | ||
ValidEvents | = | [:read, :write, :error] |
Poll the handles registered to the reactor for pending events. The following event types are defined:
Any handlers specified when the handles were registered are run for those handles with events. If a block is given, it will be invoked once for each handle which doesn’t have an explicit handler. If no block is given, events without explicit handlers are inserted into the reactor’s pendingEvents attribute.
The timeout argument is the number of floating-point seconds to wait for an event before returning (ie., fourth argument to the underlying select() call); negative timeout values will cause poll to block until there is at least one event to report.
This method returns the number of handles on which one or more events occurred.
Register the specified IO object with the reactor for events given as args. The reactor will test the given io for the events specified whenever poll is called. See the poll method for a list of valid events. If no events are specified, only :error events will be polled for.
If a handler is specified, it will be called whenever the io has any of the specified events occur to it. It should take at least two parameters: the io and the event.
If args contains any objects except the Symbols ‘:read’, ‘:write’, or ‘:error’, and a handler is specified, they will be saved and passed to handler for each event.
Registering a handle will unregister any previously registered event/handler+arguments pairs associated with the handle.
Set the additional arguments to pass to the handler for the given io handle on each event to the given args.
Set the handler for events on the given io handle to the specified handler. If any args are present, they will be passed as an exploded array to the handler for each event. Returns the previously-registered handler, if any.
Remove the specified io from the receiver’s list of registered handles, if present. Returns the handle if it was registered, or nil if it was not.