Sha256: 35aba267f68afa99881e8b42c220877f39a2fb2ad5859d0ca03d227a10a34169

Contents?: true

Size: 699 Bytes

Versions: 26

Compression:

Stored size: 699 Bytes

Contents

class Thread
  undef :name if method_defined? :name
  undef :name= if method_defined? :name=

  # 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-4.16.1 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.16.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.15.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.14.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.13.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.12.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.11.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.10.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.9.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.8.2 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.8.1 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.8.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.7.4 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.7.3 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.7.2 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.7.1 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.7.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.6.1 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.6.0 lib/semantic_logger/core_ext/thread.rb
semantic_logger-4.6.0.beta1 lib/semantic_logger/core_ext/thread.rb