mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
bpo-36084: Add native thread ID to threading.Thread objects (GH-11993)
This commit is contained in:
parent
87068ed009
commit
4959c33d25
10 changed files with 133 additions and 2 deletions
|
@ -143,6 +143,8 @@ LeaveNonRecursiveMutex(PNRMUTEX mutex)
|
|||
|
||||
unsigned long PyThread_get_thread_ident(void);
|
||||
|
||||
unsigned long PyThread_get_thread_native_id(void);
|
||||
|
||||
/*
|
||||
* Initialization of the C package, should not be needed.
|
||||
*/
|
||||
|
@ -227,6 +229,20 @@ PyThread_get_thread_ident(void)
|
|||
return GetCurrentThreadId();
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the native Thread ID (TID) of the calling thread.
|
||||
* The native ID of a thread is valid and guaranteed to be unique system-wide
|
||||
* from the time the thread is created until the thread has been terminated.
|
||||
*/
|
||||
unsigned long
|
||||
PyThread_get_thread_native_id(void)
|
||||
{
|
||||
if (!initialized)
|
||||
PyThread_init_thread();
|
||||
|
||||
return GetCurrentThreadId();
|
||||
}
|
||||
|
||||
void _Py_NO_RETURN
|
||||
PyThread_exit_thread(void)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue