Thomas Stuefe writes:
On Linux, pthread id is set in the parent thread, after pthread_create returns. Only the kernel thread id is set by the child (I find this duality confusing). thread_cpu_time uses pthread_id. So, on Linux, it may or may not be set before the thread stack boundaries are initialized, depending on whether the native entry function ran before the parent thread continued.
---
So it is still possible to see a zero pthread_t for the new thread..
- duplicates
-
JDK-8214097 Rework thread initialization and teardown logic
- Resolved
- relates to
-
JDK-8214097 Rework thread initialization and teardown logic
- Resolved
-
JDK-8212207 runtime/InternalApi/ThreadCpuTimesDeadlock.java crashes with SEGV in pthread_getcpuclockid+0x0
- Resolved