RFR: 8268425: Show decimal nid of OSThread instead of hex format one [v2]
Thomas Stuefe
stuefe at openjdk.java.net
Mon Jun 28 08:49:09 UTC 2021
On Mon, 28 Jun 2021 07:37:10 GMT, Yi Yang <yyang at openjdk.org> wrote:
>> src/hotspot/share/runtime/osThread.cpp line 41:
>>
>>> 39: // Printing
>>> 40: void OSThread::print_on(outputStream *st) const {
>>> 41: st->print("nid=%d ", thread_id());
>>
>> thread_id is of an opaque type (eg pthread_t). I think we can reasonably assume its numeric, but I would print it as an unsigned 64bit int just in case.
>
> Hi Thomas, we can not use other format specifiers (`%ld`,`%llu`) after my practice, because it can not compile on my mac:
You'd do:
print("nid: " UINT64_FORMAT, (uint64_t) id):;
thread_t is, among other things, pthread_t, which is opaque. Any current code treating that as signed int is incorrect too.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4449
More information about the serviceability-dev
mailing list