module Pantheios::Util::ThreadUtil

threading utilities

Public Class Methods

get_thread_name(t) click to toggle source

Obtains the name of the calling thread

# File lib/pantheios/util/thread_util.rb, line 27
def self.get_thread_name t

        t ||= Thread.current

        return t.thread_name if t.respond_to? :thread_name

        t.to_s
end
set_thread_name(t, name) click to toggle source

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

# 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