Method: Async::Scheduler#run

Defined in:
lib/async/scheduler.rb

#runObject

Run the reactor until all tasks are finished. Proxies arguments to #async immediately before entering the loop, if a block is provided.

Forwards all parameters to #async if a block is given.



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
# File 'lib/async/scheduler.rb', line 562

def run(...)
	Kernel.raise ClosedError if @selector.nil?
	
	begin
		@profiler&.start
		
		initial_task = self.async(...) if block_given?
		
		self.run_loop do
			run_once
		end
		
		return initial_task
	ensure
		@profiler&.stop
	end
end