Created
November 20, 2013 20:32
-
-
Save bbozo/7570484 to your computer and use it in GitHub Desktop.
EventMachine with JRuby, running reactor inside a thread doesn't work
This file contains 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 'eventmachine' | |
Thread.new{ EM.run } | |
until EM.reactor_running?; sleep 0.1; end | |
EM.add_periodic_timer(1){ puts "tick" } | |
sleep 5 |
This file contains 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
bbozo@uhurajr-ubuntu:~/dev$ ruby -v | |
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux] | |
bbozo@uhurajr-ubuntu:~/dev$ ruby em_jruby_problem.rb | |
tick | |
tick | |
tick | |
tick | |
bbozo@uhurajr-ubuntu:~/dev$ rvm use jruby | |
Using /home/bbozo/.rvm/gems/jruby-1.7.4 | |
bbozo@uhurajr-ubuntu:~/dev$ ruby em_jruby_problem.rb | |
bbozo@uhurajr-ubuntu:~/dev$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment