lib/thread/pool.rb in thread-0.0.6.1 vs lib/thread/pool.rb in thread-0.0.6.2
- old
+ new
@@ -67,18 +67,23 @@
@running = false
@finished = true
@thread = nil
end
+ # Raise an exception in the thread used by the task.
+ def raise (exception)
+ @thread.raise(exception)
+ end
+
# Terminate the exception with an optionally given exception.
def terminate! (exception = Asked)
return if terminated? || finished? || timeout?
@terminated = true
return unless running?
- @thread.raise exception
+ self.raise exception
end
# Force the task to timeout.
def timeout!
terminate! Timeout