diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-17 03:42:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-17 03:42:49 +0000 |
commit | 1133596e6ba77ddeb93552fc8274a3bbdd87e6f3 (patch) | |
tree | 4b897e771166d96f31d47f8e930824ff61532563 /lib | |
parent | 0884d0b944de777d22b963dda47294d939c9fd90 (diff) | |
download | ruby-1133596e6ba77ddeb93552fc8274a3bbdd87e6f3.tar.gz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/timeout.rb | 3 |
1 files changed, 1 insertions, 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 |