# File lib/amqp/utilities/event_loop_helper.rb, line 63 def self.run(&block) if reactor_running? EventMachine.run(&block) return end @eventmachine_thread ||= begin case self.server_type when :thin, :goliath, :evented_mongrel then EventMachine.next_tick { block.call } Thread.current when :unicorn, :passenger, :mongrel, :scgi, :webrick, nil then t = Thread.new { EventMachine.run(&block) } # give EventMachine reactor some time to start sleep(0.25) t else t = Thread.new { EventMachine.run(&block) } # give EventMachine reactor some time to start sleep(0.25) t end end @eventmachine_thread end