Concurrency and Process Modules
_thread
Low-level thread primitives used by higher-level threading interfaces. Locks are primitive synchronization objects, not ownership-aware reentrant locks. Prefer threading for lifecycle management and joins. This example does not start a low-level thread.
Formal Syntax & Structure
python syntaxpython
import _threadReturn Value
module
Module namespace available through import; import is a statement, not a value-returning expression.
Working Example
Example Snippetpython
import _threadlock = _thread.allocate_lock()with lock: print(lock.locked())