Skip to content

Instantly share code, notes, and snippets.

@fbernier
Created July 12, 2012 17:45
Show Gist options
  • Save fbernier/3099594 to your computer and use it in GitHub Desktop.
Save fbernier/3099594 to your computer and use it in GitHub Desktop.
require "celluloid"
class MyClass
include Celluloid
def initialize
@a = 0
end
def do_something
@a += 1
end
end
pool = MyClass.pool
p Celluloid::Actor.all.count
f = []
25.times do |t|
f << pool.future(:do_something)
end
# Here we redefine our pool, and it doubles the actor count
pool = MyClass.pool
p Celluloid::Actor.all.count
25.times do |t|
f << pool.future(:do_something)
end
f.map(&:value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment