Method: Narou::Worker#start
- Defined in:
- lib/web/worker.rb
#start ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/web/worker.rb', line 26 def start return if running? @worker_thread = Thread.new do loop do begin q = @queue.pop q[:block].call rescue SystemExit rescue Exception => e # Workerスレッド内での例外は表示するだけしてスレッドは生かしたままにする STDOUT.puts $@.shift + ": #{e.message} (#{e.class})" $@.each do |b| STDOUT.puts " from #{b}" end ensure if q[:counting] countdown notification_queue end end end end end |