Class: Core::Async::Reactor
- Includes:
- Is::Async, Is::Inspectable
- Defined in:
- lib/core/async/reactor.rb
Overview
- public
-
Creates a top-level async context that runs until all scheduled work is complete.
Class Method Summary collapse
-
.run(&block) ⇒ Object
- public
-
Create a new reactor and immediately run it.
Methods included from Is::Async
Methods inherited from Scheduler
#block, #cancel, #close, #fiber, #initialize, #io_wait, #kernel_sleep, #observe, #process_wait, #run, #running?, #stop, #tick, #timeout, #unblock
Constructor Details
This class inherits a constructor from Core::Async::Scheduler
Class Method Details
.run(&block) ⇒ Object
- public
-
Create a new reactor and immediately run it.
20 21 22 23 24 25 26 27 |
# File 'lib/core/async/reactor.rb', line 20 def run(&block) instance = new original_scheduler = Fiber.scheduler Fiber.set_scheduler(instance) instance.run(&block) ensure Fiber.set_scheduler(original_scheduler) end |