Skip to content

Instantly share code, notes, and snippets.

@jacobo
Created May 17, 2013 17:24
Show Gist options
  • Select an option

  • Save jacobo/5600586 to your computer and use it in GitHub Desktop.

Select an option

Save jacobo/5600586 to your computer and use it in GitHub Desktop.
require 'celluloid'
class Worker
include Celluloid
def work(x)
sleep 0.2; puts x*x
end
end
worker_pool = Worker.pool(size: 10)
(0..99).to_a.each{|x| worker_pool.async.work x }
sleep 2 #how do I wait the right amount of time before terminating?
worker_pool.terminate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment