vendor/bundle/ruby/1.8/gems/io-reactor-1.0.4/lib/io/reactor.rb
def poll( timeout=-1 ) # :yields: io, eventMask
		timeout = timeout.to_f
		@pending_events.clear
		count = 0

		unless @handles.empty?
			timeout = nil if timeout < 0
			evented_handles = self.get_pending_events( timeout )

			# For each event of each io that had an event happen, call any
			# associated callback, or any provided block, or failing both of
			# those, add the event to the hash of unhandled pending events.
			evented_handles.each do |io,events|
				count += 1
				events.each do |ev|
					# Don't continue if the io was unregistered by an earlier handler
					break unless @handles.key?( io )
					
					args = @handles[ io ][:args]

					if @handles[ io ][:handler]
						@handles[ io ][:handler].call( io, ev, *args )
					elsif block_given?
						yield( io, ev, *args )
					else
						@pending_events[io].push( ev )
					end
				end
			end
		end

		return count
	end
### Poll the handles registered to the reactor for pending events. The
### following event types are defined:
###
### [<tt>:read</tt>]
###   Data may be read from the handle without blocking.
### [<tt>:write</tt>]
###   Data may be written to the handle without blocking.
### [<tt>:error</tt>]
###   An error has occurred on the handle. This event type is always
###   enabled, regardless of whether or not it is passed as one of the
###   <tt>events</tt>.
###
### 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
### <tt>pending_events</tt> attribute.
###
### The <tt>timeout</tt> argument is the number of floating-point seconds to
### wait for an event before returning (ie., fourth argument to the
### underlying <tt>select()</tt> 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.
Poll the handles registered to the reactor for pending events. The
following event types are defined.

[:read]
Data may be read from the handle without blocking.
[:write]
Data may be written to the handle without blocking.
[:error]
An error has occurred on the handle. This event type is always
enabled, regardless of whether or not it is passed as one of the
events.

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
pending_events attribute.

The timeout argument is the number of floating-point seconds to
wait for an event before returning  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.
Poll the handles registered to the reactor for pending events . The following event types are defined . [ : read ] Data may be read from the handle without blocking . [ : write ] Data may be written to the handle without blocking . [ : error ] An error has occurred on the handle . This event type is always enabled regardless of whether or not it is passed as one of the events . 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 pending_events attribute . The timeout argument is the number of floating - point seconds to wait for an event before returning 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 .
def poll( timeout=-1 ) 
		timeout = timeout.to_f
		@pending_events.clear
		count = 0
		unless @handles.empty?
			timeout = nil if timeout < 0
			evented_handles = self.get_pending_events( timeout )
			evented_handles.each do |io,events|
				count += 1
				events.each do |ev|
					break unless @handles.key?( io )
					args = @handles[ io ][:args]
					if @handles[ io ][:handler]
						@handles[ io ][:handler].call( io, ev, *args )
					elsif block_given?
						yield( io, ev, *args )
					else
						@pending_events[io].push( ev )
					end
				end
			end
		end
		return count
	end
def poll ( timeout = - 1 ) timeout = timeout . to_f @pending_events . clear count = 0 unless @handles . empty? timeout = nil if timeout < 0 evented_handles = self . get_pending_events ( timeout ) evented_handles . each do | io , events | count += 1 events . each do | ev | break unless @handles . key? ( io ) args = @handles [ io ] [ :args ] if @handles [ io ] [ :handler ] @handles [ io ] [ :handler ] . call ( io , ev , * args ) elsif block_given? yield ( io , ev , * args ) else @pending_events [ io ] . push ( ev ) end end end end return count end
Poll the handles registered to the reactor for pending events.
Poll the handles registered to the reactor for pending events .
# :yields: io, eventMask # For each event of each io that had an event happen, call any # associated callback, or any provided block, or failing both of # those, add the event to the hash of unhandled pending events. # Don't continue if the io was unregistered by an earlier handler
timeout