[前][次][番号順一覧][スレッド一覧]

ruby-changes:41122

From: nobu <ko1@a...>
Date: Sat, 19 Dec 2015 00:47:00 +0900 (JST)
Subject: [ruby-changes:41122] nobu:r53195 (trunk): timeout.rb: watcher thread name

nobu	2015-12-19 00:46:50 +0900 (Sat, 19 Dec 2015)

  New Revision: 53195

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53195

  Log:
    timeout.rb: watcher thread name
    
    * lib/timeout.rb (Timeout#timeout): set watcher thread name to
      caller location for debugging.

  Modified files:
    trunk/lib/timeout.rb
Index: lib/timeout.rb
===================================================================
--- lib/timeout.rb	(revision 53194)
+++ lib/timeout.rb	(revision 53195)
@@ -73,11 +73,13 @@ module Timeout https://github.com/ruby/ruby/blob/trunk/lib/timeout.rb#L73
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]