Thread Native ID Access
Martin Buchholz
martinrb at google.com
Wed Feb 21 23:46:29 UTC 2018
On Wed, Feb 21, 2018 at 2:40 PM, Jeremy Manson <jeremymanson at google.com>
wrote:
>
> 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...
>
This is very similar to the question of what to do for e.g. Process#pid
https://docs.oracle.com/javase/9/docs/api/java/lang/Process.html#pid--
Note the Posixy naming of the method and its long return type.
When I was thinking about this 10 years ago, I was expecting us to
represent it as a String inside the JVM, which would be more flexible, but
it hasn't caused any trouble so far. Since thread ids are even more system
dependent, the case for String is stronger. It's at least plausible that
there are no native threads on the platform
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20180221/6ff24e37/attachment.html>
More information about the serviceability-dev
mailing list