mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
70bf86a711
commit
d660e06f28
1 changed files with 2 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue