class Async::Scheduler

def scheduler_close(error = $!)

Executes the run loop until all tasks are finished, then closes the scheduler.

Invoked when the fiber scheduler is being closed.
def scheduler_close(error = $!)
	# If the execution context (thread) was handling an exception, we want to exit as quickly as possible:
	unless error
		self.run
	end
ensure
	self.close
end