class Async::Task

def schedule(&block)

def schedule(&block)
	@fiber = Fiber.new do
		set!
		
		begin
			@result = yield
			@status = :complete
			# Console.logger.debug(self) {"Task was completed with #{@children.size} children!"}
		rescue Stop
			stop!
		rescue StandardError => error
			fail!(error, false)
		rescue Exception => exception
			fail!(exception, true)
		ensure
			# Console.logger.info(self) {"Task ensure $! = #{$!} with #{@children&.size.inspect} children!"}
			finish!
		end
	end
	
	self.root.resume(@fiber)
end