Skip to content

Instantly share code, notes, and snippets.

@cjbottaro
Created August 24, 2011 07:56
Show Gist options
  • Save cjbottaro/1167520 to your computer and use it in GitHub Desktop.
Save cjbottaro/1167520 to your computer and use it in GitHub Desktop.
sleep in EM reactor
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