From 8dd95b04062118e4b6ed86a6c62d75270f4de0b3 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 18 Dec 2015 15:46:50 +0000 Subject: timeout.rb: watcher thread name * lib/timeout.rb (Timeout#timeout): set watcher thread name to caller location for debugging. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/timeout.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/timeout.rb') diff --git a/lib/timeout.rb b/lib/timeout.rb index 79d28b6c5e..792a7c1093 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -73,11 +73,13 @@ module Timeout def timeout(sec, klass = nil) #:yield: +sec+ return yield(sec) if sec == nil or sec.zero? message = "execution expired".freeze + from = "from #{caller_locations(1, 1)[0]}" if $DEBUG e = Error bl = proc do |exception| begin x = Thread.current y = Thread.start { + Thread.current.name = from begin sleep sec rescue => e -- cgit v1.2.3