class Doctrine::Runner
- public
Public Class Methods
new(reporter:)
click to toggle source
# File lib/doctrine/runner.rb, line 11 def initialize(reporter:) @reporter = reporter @condition = new_cond @queue = Queue.new @worker = Worker.new(queue: @queue, runner: self) @thread = Thread.new { @worker.run } @enqueued = [] @working = [] @finished = [] end
Public Instance Methods
finished(tenet)
click to toggle source
- public
# File lib/doctrine/runner.rb, line 39 def finished(tenet) @reporter.finished(tenet) @working.delete(tenet) @finished << tenet synchronize do @condition.signal end end
run(tenet)
click to toggle source
- public
# File lib/doctrine/runner.rb, line 24 def run(tenet) @enqueued << tenet @queue << tenet end
starting(tenet)
click to toggle source
- public
# File lib/doctrine/runner.rb, line 31 def starting(tenet) @reporter.starting(tenet) @enqueued.delete(tenet) @working << tenet end
wait()
click to toggle source
- public
# File lib/doctrine/runner.rb, line 51 def wait synchronize do @condition.wait_until do @enqueued.empty? && @working.empty? end end end