From ce48e9a9301c517f99b85e225dd73b72a0833956 Mon Sep 17 00:00:00 2001 From: tarui Date: Wed, 5 Dec 2012 15:53:27 +0000 Subject: * lib/timeout.rb (Timeout#timeout): specify a exception more strictly at async_interrupt_timing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/timeout.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/timeout.rb') diff --git a/lib/timeout.rb b/lib/timeout.rb index da4eae39a1..ee20115754 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -49,8 +49,8 @@ module Timeout # a module method, so you can call it directly as Timeout.timeout(). def timeout(sec, klass = nil, immediate: false) #:yield: +sec+ return yield(sec) if sec == nil or sec.zero? - Thread.async_interrupt_timing(klass ? klass : ExitException => immediate ? :immediate : :on_blocking) do - exception = klass || Class.new(ExitException) + exception = klass || Class.new(ExitException) + Thread.async_interrupt_timing(exception => immediate ? :immediate : :on_blocking) do begin begin x = Thread.current -- cgit v1.2.3