Method: Tpool::Block#run
- Defined in:
- lib/tpool_block.rb
#run ⇒ Object
Starts running whatever block it is holding.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/tpool_block.rb', line 15 def run @thread_running = Thread.current @thread_running.priority = @tpool.args[:priority] if @tpool.args.key?(:priority) @running = true begin @res = @args[:blk].call(*@args[:args], &@args[:blk]) rescue Exception => e @error = e @args[:tpool].on_error_call(:error => e, :block => self) ensure @running = false @done = true @thread_running = nil end if @args[:thread_starts] @args[:thread_starts].each do |thread| thread.wakeup if thread.alive? end end return self end |