@@ 20,6 20,13 @@ module EventMachine end
def run
+ # After tails run, set reactor_running to false
+ # this works around a race condition against next_tick
+ # while shutting down
+ EM.instance_variable_get(:@tails).unshift(lambda do
+ EM.instance_variable_set(:@reactor_running, false)
+ end)
+ tick
EM.run
end