threading.get_native_id
Prev: threading.get_ident | Up: threading | Next: threading.getprofile
Rel: threading.active_count, threading.Barrier, threading.BoundedSemaphore, threading.BrokenBarrierError
Ref: docs.python.org — threading.get_native_id
Tags: #public #python3 #stdlib #threading
Import
import threading
from threading import get_native_id
Signature & Overview
threading.get_native_id()
Return a non-negative integer identifying the thread as reported by the OS (kernel). This may be used to uniquely identify a particular thread within a system.
Usage
import threading
tid = threading.get_native_id()
assert isinstance(tid, int) and tid > 0
Gotchas
- OS kernel thread ID: Matches the TID shown by OS profilers and debuggers; available on macOS, Linux, Windows, and FreeBSD.
REPL Inspect
from threading import get_native_id
help(get_native_id)
Linked from
Related notes
- tuts/python3/stdlib_module/threading/get_ident Linked here; links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/getprofile Linked here; links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/threading/active_count Linked here; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/Barrier Linked here; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/BoundedSemaphore Linked here; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/BrokenBarrierError Linked here; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/Condition shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/current_thread shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/enumerate shared tags: #stdlib, #threading