linux, os::current_thread_id() vs os::Linux::gettid()

Thomas Stüfe thomas.stuefe at gmail.com
Mon Aug 25 14:55:57 UTC 2014


Hi,

I wonder about the implementation of os::current_thread_id() on Linux.

There is os::Linux::gettid() and os::current_thread_id().
os::Linux::gettid() returns the kernel thread id, os::current_thread_id()
returns the pthread id.

os::Linux::gettid() is used to initialize OSThread::_thread_id, so that
contains the kernel thread id. So now we get conflicting information from
OSThread::thread_id and os::current_thread_id().

As far as I see, all other platforms consistently return the kernel thread
id on both code paths.

Am I overlooking something or is this behaviour intentional?

Kind Regards,

..Thomas


More information about the hotspot-dev mailing list