Created
July 1, 2013 14:41
-
-
Save makevoid/5901415 to your computer and use it in GitHub Desktop.
Celluloid test playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'celluloid' | |
| DB = { count: 0 } | |
| class Actor | |
| include Celluloid | |
| def do_stuff | |
| # sleep 1 | |
| DB[:count] += 1 | |
| puts DB[:count] if DB[:count] == 1000 | |
| end | |
| end | |
| 2000.times do | |
| actor = Actor.new | |
| actor.async.do_stuff | |
| end | |
| puts "started!" | |
| sleep 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment