[New-bugs-announce] [issue43879] Add native_id to PyThreadState

Gabriele Tornetta report at bugs.python.org
Sat Apr 17 05:18:44 EDT 2021


New submission from Gabriele Tornetta <phoenix1987 at gmail.com>:

I would like to propose adding the native_id field to the PyThreadState structure to store the result of PyThread_get_thread_native_id. On some systems, like Linux, it is not easy to retrieve this information from outside of the Python interpreter process.

Tools like Austin (https://github.com/P403n1x87/austin) could benefit from this for CPU time sampling. Currently, if one wants to retrieve the TID from a PyThreadState instance is to regard thread_id as a pointer to a struct pthread structure, loop over all the Python threads to find the one that has the PID for TID and infer the offset of the tid field within struct pthread, which is not ideal.

----------
components: C API
messages: 391276
nosy: Gabriele Tornetta
priority: normal
severity: normal
status: open
title: Add native_id to PyThreadState
type: enhancement
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43879>
_______________________________________


More information about the New-bugs-announce mailing list