class Core::Async::Reactor
- public
-
The top-level async context. Runs until all scheduled work is complete.
Public Class Methods
run(&block)
click to toggle source
- public
-
Create a new reactor and immediately run it.
# File lib/core/async/reactor.rb, line 19 def run(&block) instance = new instance.run(&block) end
Public Instance Methods
run() { |self| ... }
click to toggle source
- public
-
Run the reactor, yielding within the async context.
# File lib/core/async/reactor.rb, line 27 def run if (task = ::Async::Task.current?) reference = task.async { |child| @runnable = child yield self } wait_all(reference) else @runnable = ::Async::Reactor.new @runnable.run { async { yield self }.result }.wait end end
stop()
click to toggle source
- public
-
Stop the reactor.
# File lib/core/async/reactor.rb, line 49 def stop @runnable&.stop end