summaryrefslogtreecommitdiff
path: root/lib/timeout.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/timeout.rb')
-rw-r--r--lib/timeout.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/timeout.rb b/lib/timeout.rb
index 9625db7..dc8eb24 100644
--- a/lib/timeout.rb
+++ b/lib/timeout.rb
@@ -73,6 +73,9 @@ module Timeout
# ensure to prevent the handling of the exception. For that reason, this
# method cannot be relied on to enforce timeouts for untrusted blocks.
#
+ # If a scheduler is defined, it will be used to handle the timeout by invoking
+ # Scheduler#timeout_after.
+ #
# Note that this is both a method of module Timeout, so you can <tt>include
# Timeout</tt> into your classes so they have a #timeout method, as well as
# a module method, so you can call it directly as Timeout.timeout().
@@ -81,8 +84,8 @@ module Timeout
message ||= "execution expired".freeze
- if (scheduler = Fiber.scheduler)&.respond_to?(:timeout_raise)
- return scheduler.timeout_raise(sec, klass || Error, message, &block)
+ if (scheduler = Fiber.scheduler)&.respond_to?(:timeout_after)
+ return scheduler.timeout_after(sec, klass || Error, message, &block)
end
from = "from #{caller_locations(1, 1)[0]}" if $DEBUG