diff options
author | Jake Tesler <jake.tesler@gmail.com> | 2019-05-12 17:08:24 (GMT) |
---|---|---|
committer | Antoine Pitrou <antoine@python.org> | 2019-05-12 17:08:24 (GMT) |
commit | 4959c33d2555b89b494c678d99be81a65ee864b0 (patch) | |
tree | 87df7778f170864ef1efe3418ac3cb3c47051c50 /Python/thread_nt.h | |
parent | 87068ed00927bdeaa2ae556e4241c16cf8a845eb (diff) | |
download | cpython-4959c33d2555b89b494c678d99be81a65ee864b0.zip cpython-4959c33d2555b89b494c678d99be81a65ee864b0.tar.gz cpython-4959c33d2555b89b494c678d99be81a65ee864b0.tar.bz2 |
bpo-36084: Add native thread ID to threading.Thread objects (GH-11993)
Diffstat (limited to 'Python/thread_nt.h')
-rw-r--r-- | Python/thread_nt.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Python/thread_nt.h b/Python/thread_nt.h index 5e00c35..d3dc2be 100644 --- a/Python/thread_nt.h +++ b/Python/thread_nt.h @@ -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) { |