lib/tpool_block.rb in tpool-0.0.1 vs lib/tpool_block.rb in tpool-0.0.2
- old
+ new
@@ -3,24 +3,26 @@
#Constructor. Should not be called manually.
def initialize(args)
@args = args
+ @tpool = @args[:tpool]
@running = false
@done = false
@error = nil
end
#Starts running whatever block it is holding.
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(:on_error, e)
+ @args[:tpool].on_error_call(:error => e, :block => self)
ensure
@running = false
@done = true
@thread_running = nil
end
\ No newline at end of file