ruby-changes:36386
From: nobu <ko1@a...>
Date: Mon, 17 Nov 2014 12:42:59 +0900 (JST)
Subject: [ruby-changes:36386] nobu:r48467 (trunk): timeout.rb: same object across fiber
nobu 2014-11-17 12:42:49 +0900 (Mon, 17 Nov 2014) New Revision: 48467 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48467 Log: 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. Modified files: trunk/lib/timeout.rb Index: lib/timeout.rb =================================================================== --- lib/timeout.rb (revision 48466) +++ lib/timeout.rb (revision 48467) @@ -31,17 +31,16 @@ module Timeout https://github.com/ruby/ruby/blob/trunk/lib/timeout.rb#L31 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/