def poll( timeout=-1 )
raise TypeError, "Timeout must be Numeric, not a #{timeout.type.name}" unless
timeout.kind_of? Numeric
timeout = timeout.to_f
@events.clear
unless @masks.empty?
@events = _poll( @masks.to_a, timeout*1000 )
@events.each {|io,evmask|
if @callbacks.has_key?( io )
args = @callbacks[ io ][ :args ]
@callbacks[ io ][ :callback ].call( io,
EventMask::new(evmask),
*args )
elsif block_given?
yield( io, EventMask::new(evmask) )
end
}
end
@events.default = EventMask::new( 0 )
return @events.length
end