class Async::Scheduler

def io_wait(io, events, timeout = nil)

def io_wait(io, events, timeout = nil)
	wrapper = from_io(io)
	
	if events == ::IO::READABLE
		if wrapper.wait_readable(timeout)
			return ::IO::READABLE
		end
	elsif events == ::IO::WRITABLE
		if wrapper.wait_writable(timeout)
			return ::IO::WRITABLE
		end
	else
		if wrapper.wait_any(timeout)
			return events
		end
	end
	
	return false
ensure
	wrapper.reactor = nil
end