diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-18 15:46:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-18 15:46:50 +0000 |
commit | d660e06f2830af2a99c57746b2953a5638b959c1 (patch) | |
tree | fb867b17f302c83877f1982bef915ee1bbc88f76 /lib/timeout.rb | |
parent | 70bf86a71186052a201360a69c7326e7c603fae0 (diff) |
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
Diffstat (limited to 'lib/timeout.rb')
-rw-r--r-- | lib/timeout.rb | 2 |
1 files changed, 2 insertions, 0 deletions
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 |