New submission from Gabriele Tornetta <phoenix1...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue43879>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to