os::current_thread_id on Linux

Martin Buchholz martinrb at google.com
Wed Jul 22 21:51:37 UTC 2015


It would be nice if even internal hotspot APIs had clear specs. All we have
now is:

  // thread id on Linux/64bit is 64bit, on Windows and Solaris, it's 32bit
  static intx current_thread_id();

pthread_self() is documented as being an opaque value that cannot
necessarily be stored in a native integral type, so casting to intx is a
bit bogus.  (but yeah, this is hotspot, we can get away with non-portable
code)

For debugging purposes, it would be nice to have convenient access to all
of the various "current thread" values: pthread_self(), gettid(), hotspot
C++ thread object, java thread object, java thread id.  But that doesn't
fit with a function returning intx, and whose uniqueness is also used for
locking.


More information about the hotspot-runtime-dev mailing list