Created
August 24, 2011 07:56
-
-
Save cjbottaro/1167520 to your computer and use it in GitHub Desktop.
sleep in EM reactor
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
EM.run do | |
t = Time.now | |
Fiber.new{ sleep(1) }.resume | |
Fiber.new{ sleep(1) }.resume | |
puts Time.now - t | |
# 2 seconds have elapsed. No concurrency is achieved. | |
EM.stop | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment