mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-36084: Add native thread ID (TID) to threading.Thread (GH-13463)
Add native thread ID (TID) to threading.Thread objects (supported platforms: Windows, FreeBSD, Linux, macOS).
This commit is contained in:
parent
b3be407288
commit
b121f63155
9 changed files with 154 additions and 0 deletions
|
@ -104,6 +104,11 @@ class ThreadTests(BaseTestCase):
|
|||
self.assertRegex(repr(t), r'^<TestThread\(.*, initial\)>$')
|
||||
t.start()
|
||||
|
||||
if hasattr(threading, 'get_native_id'):
|
||||
native_ids = set(t.native_id for t in threads) | {threading.get_native_id()}
|
||||
self.assertNotIn(None, native_ids)
|
||||
self.assertEqual(len(native_ids), NUMTASKS + 1)
|
||||
|
||||
if verbose:
|
||||
print('waiting for all tasks to complete')
|
||||
for t in threads:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue