Skip to content

Instantly share code, notes, and snippets.

@tiagopog
Created August 30, 2017 13:15
Show Gist options
  • Save tiagopog/9ab59474c8800c413d663fbe23dac120 to your computer and use it in GitHub Desktop.
Save tiagopog/9ab59474c8800c413d663fbe23dac120 to your computer and use it in GitHub Desktop.
Event Machine usage example.
# em.rb
EM.run do
EM.add_timer(1) do
puts 'sleeping...'
EM.system('sleep 1') { puts "woke up!" }
puts 'continuing...'
end
EM.add_timer(3) { EM.stop }
end
$ ruby em.rb
sleeping...
continuing...
woke up!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment