class Async::Task

def wait

Returns:
  • (Object) - the final expression/result of the task's block.

Raises:
  • (RuntimeError) - if the task's fiber is the current fiber.
def wait
	raise RuntimeError, "Cannot wait on own fiber" if Fiber.current.equal?(@fiber)
	
	if running?
		@finished ||= Condition.new
		@finished.wait
	else
		Task.yield{@result}
	end
end