Sha256: 338b59c32b4a6f2f4461c7ea767df3c0c00fa8e65d8a991fdcc51ce3fe94da2c

Contents?: true

Size: 634 Bytes

Versions: 26

Compression:

Stored size: 634 Bytes

Contents

require 'thread'
class Thread
  # Returns the name of the current thread
  # Default:
  #    JRuby: The underlying Java thread name
  #    Other: String representation of this thread's object_id
  if defined? JRuby
    def name
      @name ||= JRuby.reference(self).native_thread.name
    end
  else
    def name
      @name ||= object_id.to_s
    end
  end

  # Set the name of this thread
  #   On JRuby it also sets the underlying Java Thread name
  if defined? JRuby
    def name=(name)
      JRuby.reference(self).native_thread.name = @name = name.to_s
    end
  else
    def name=(name)
      @name = name.to_s
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
semantic_logger-2.10.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.9.2 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.9.1 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.9.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.8.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.7.0 lib/semantic_logger/core_ext/thread.rb