Provides some convenient methods for EventMachine's Reactor.
@author Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
Blocks until the Reactor stops running
# File lib/arachni/rpc/em/em.rb, line 36 def block # beware of deadlocks, we can't join our own thread ::EM.reactor_thread.join if ::EM.reactor_thread && !::EM::reactor_thread? end
Puts the Reactor in its own thread and runs it.
# File lib/arachni/rpc/em/em.rb, line 42 def ensure_em_running if !::EM::reactor_running? Thread.new do ::EM.run do ::EM.error_handler do |e| $stderr.puts "Exception raised during event loop: " + "#{e.message} (#{e.class})\n#{(e.backtrace || [])[0..5].join("\n")}" end end end sleep 0.1 while !::EM.reactor_running? end end
Generated with the Darkfish Rdoc Generator 2.