class Async::Scheduler

def self.supported?

def self.supported?
	true
end

def self.supported?

def self.supported?
	false
end

def block(blocker, timeout)

def block(blocker, timeout)
	@reactor.block(blocker, timeout)
end

def clear!

def clear!
	Fiber.set_scheduler(nil)
end

def close

def close
end

def fiber(&block)

def fiber(&block)
	task = Task.new(@reactor, &block)
	
	fiber = task.fiber
	
	task.run
	
	return fiber
end

def from_io(io)

def from_io(io)
.new(io, @reactor)

def initialize(reactor)

def initialize(reactor)
	@reactor = reactor
end

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
rescue TimeoutError
	return nil
ensure
	wrapper&.reactor = nil
end

def kernel_sleep(duration)

def kernel_sleep(duration)
	self.block(nil, duration)
end

def process_wait(pid, flags)

@returns [Process::Status] A process status instance.
@parameter flags [Integer] A bit-mask of flags suitable for `Process::Status.wait`.
@parameter pid [Integer] The process ID to wait for.
Wait for the specified process ID to exit.
def process_wait(pid, flags)
	Thread.new do
		::Process::Status.wait(pid, flags)
	end.value
end

def set!

def set!
	Fiber.set_scheduler(self)
end

def unblock(blocker, fiber)

def unblock(blocker, fiber)
	@reactor.unblock(blocker, fiber)
end