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-3.4.1 lib/semantic_logger/core_ext/thread.rb
semantic_logger-3.4.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-3.3.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-3.2.1 lib/semantic_logger/core_ext/thread.rb
semantic_logger-3.2.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-3.1.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-3.0.1 lib/semantic_logger/core_ext/thread.rb
semantic_logger-3.0.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.21.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.20.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.19.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.18.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.17.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.16.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.15.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.14.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.13.1 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.13.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.12.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-2.11.0 lib/semantic_logger/core_ext/thread.rb