lib/abstractivator/fiber_defer.rb in abstractivator-0.15.0 vs lib/abstractivator/fiber_defer.rb in abstractivator-0.16.0
- old
+ new
@@ -96,9 +96,15 @@
raise 'fiber_defer must be called within a with_fiber_defer block' if f == ROOT_FIBER
safe_action = proc do
begin
[action.call, nil]
+ rescue SignalException => e
+ # The thread has been instructed to shut down, so let it.
+ # Don't pass on the exception to another thread/fiber.
+ # We will assume whatever is shutting down the thread will
+ # also account for the paused fiber on its own.
+ raise
rescue Exception => e
[nil, e]
end
end