Method: Pantheios::Util::ThreadUtil.set_thread_name

Defined in:
lib/pantheios/util/thread_util.rb

.set_thread_name(t, name) ⇒ Object

Creates (if necessary) and sets the given thread’s thread_name attribute to the given name

Signature

  • Parameters:

  • t [Thread, nil] The thread to be named, or nil if it should operate on the current (invoking) thread

  • name [String] The thread’s name



17
18
19
20
21
22
23
24
# File 'lib/pantheios/util/thread_util.rb', line 17

def self.set_thread_name t, name

  t ||= Thread.current

  class << t; attr_accessor :thread_name; end unless t.respond_to? :thread_name

  t.thread_name = name
end