Thread Native ID Access
David Holmes
david.holmes at oracle.com
Thu Feb 22 05:21:26 UTC 2018
Hi Jeremy,
I think "thread id" is too platform specific to be exposed in a core
Java API like Thread - even as a non-descript String.
Maybe through a platform specific MXBean API?
For things like /proc/<pid>/task/<nid> is there a way to say <nid> in a
way that means "current thread"? That may be a partial solution - or
even whole if you could then read back the actual id?
David
On 22/02/2018 8:40 AM, Jeremy Manson wrote:
> Hey folks,
>
> I mentioned earlier in the thread about the ThreadInfo.from() bug that I
> found this because I was looking at fixing JDK-8154176, which proposes
> introducing native thread ids to Thread and ThreadInfo.
>
> https://bugs.openjdk.java.net/browse/JDK-8154176
>
> I have a prototype for it. I have a couple of questions, though:
>
> 0) Does anyone object to this being done or my doing it? I see that it
> already has an owner.
>
> 1) Should the ID be a long? The Hotspot thread dump prints it out as
> 0x%x, which is an unsigned hexadecimal integer. The type hiding behind
> it is platform-dependent, though: a pid_t on Linux, an unsigned long on
> Windows, a thread_t on Solaris. I could make it a String instead...
>
> Jeremy
More information about the serviceability-dev
mailing list