module Circuitry::Processors::Threader

Public Class Methods

flush() click to toggle source
# File lib/circuitry/processors/threader.rb, line 18
def flush
  pool.each(&:join)
ensure
  pool.clear
end
process(&block) click to toggle source
# File lib/circuitry/processors/threader.rb, line 9
def process(&block)
  raise ArgumentError, 'no block given' unless block_given?

  pool << Thread.new do
    safely_process(&block)
    on_exit.call if on_exit
  end
end