зеркало из https://github.com/github/ruby.git
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:
Родитель
70bf86a711
Коммит
d660e06f28
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче