-
-
Save meetme2meat/e277b0efae9e2a0cdfc2 to your computer and use it in GitHub Desktop.
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
## Even with sleep 0 the code does not work and no message is ever printed over STDOUT. | |
## which is weird considering the celluloid-zmq (working.rb) example work with almost same code. | |
require 'celluloid' | |
class Server | |
include Celluloid | |
def run | |
loop { [1].each { |i| async.handle_message 'hello' } ; sleep(0) } | |
end | |
def handle_message(message) | |
puts "got message: #{message}" | |
end | |
end | |
server = Server.new() | |
server.async.run | |
sleep | |
#### OUTPUT #### | |
I, [2015-09-19T17:39:08.116435 #17876] INFO -- : Celluloid 0.17.1.1 is running in BACKPORTED mode. [ http://git.io/vJf3J ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment