From 1133596e6ba77ddeb93552fc8274a3bbdd87e6f3 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 17 Nov 2014 03:42:49 +0000 Subject: timeout.rb: same object across fiber * lib/timeout.rb (Timeout::ExitException.catch): do not freeze the exception for tag, so that the same object can be passed to the target fiber without duplication to attach backtrace at raise. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/timeout.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/timeout.rb b/lib/timeout.rb index cf23fb5fb6..fec7b9428c 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -31,17 +31,16 @@ module Timeout def self.catch(*args) exc = new(*args) exc.instance_variable_set(:@thread, Thread.current) - exc.freeze ::Kernel.catch(exc) {yield exc} end def exception(*) + # TODO: use Fiber.current to see if self can be thrown if self.thread == Thread.current bt = caller begin throw(self, bt) rescue UncaughtThrowError - raise Error, message, backtrace end end self -- cgit v1.2.3