class Async::Task

def schedule(&block)

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