class ActiveConcurrency::Schedulers::RoundRobin

Public Class Methods

new(pool, _options) click to toggle source
# File lib/active_concurrency/schedulers/round_robin.rb, line 7
def initialize(pool, _options)
  mutex = Mutex.new
  @pool = pool.each { |w| w.mutex = mutex }.cycle
end

Public Instance Methods

schedule(*args, &block) click to toggle source
# File lib/active_concurrency/schedulers/round_robin.rb, line 12
def schedule(*args, &block)
  worker = @pool.next
  worker.schedule(*args, &block)
end