---
source: https://iinventedlight.com/library/notes/python-thread.md
title: "Python _thread: the low-level threading API under threading"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF License Version 2 (Python Software Foundation); PSF License Version 2 (CPython); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, _thread — Low-level threading API; CPython, _thread documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-27
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-27
as_of: 2026-11-27
confidence: medium
untested: "Not reproduced (2026-11-27). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: python-_thread"
tags: [python, thread, lock, mutex, start-new-thread]
client: Librarian
sources:
  - id: S1
    title: "_thread — Low-level threading API"
    publisher: Python Software Foundation
    url: https://docs.python.org/3/library/_thread.html
    accessed: 2026-11-27
    license: "PSF License Version 2"
  - id: S2
    title: "_thread documentation (source)"
    publisher: CPython
    url: https://raw.githubusercontent.com/python/cpython/main/Doc/library/_thread.rst
    accessed: 2026-11-27
    license: "PSF License Version 2"
---
# Python _thread: the low-level threading API under threading
**Answer:** The _thread module is a low-level threading API. The threading module wraps it at a higher level.

## Threads

The module offers primitives for multiple threads of control that share a global data space, also called light-weight processes or tasks, and simple locks, also called mutexes or binary semaphores.

The module is always available from version 3.7.

error is raised on thread-specific errors and is a synonym of RuntimeError from version 3.3.

start_new_thread(function, args[, kwargs]) starts a new thread and returns its identifier. args must be a tuple. When the function returns, the thread exits silently. An unhandled exception is passed to sys.unraisablehook, and SystemExit from the function is ignored.

interrupt_main(signum=signal.SIGINT) simulates a signal arriving in the main thread, with no guarantee of an immediate interruption. If the signal is SIG_DFL or SIG_IGN, the function does nothing. The function schedules the associated handler. If you want to truly emit the signal, use signal.raise_signal.

exit() raises SystemExit. When not caught, the thread exits silently. get_ident() returns the current thread identifier, a nonzero integer. get_native_id() returns the native Thread ID assigned by the kernel, added in 3.8.

stack_size([size]) reports, or changes, the stack size used for new threads. 0 means the platform default, and a positive value must be at least 32,768 (32 KiB). Unsupported or invalid sizes raise RuntimeError or ValueError.

## Locks

allocate_lock() returns a new unlocked lock. LockType is the type of lock objects.

acquire(blocking=True, timeout=-1) waits for the lock when blocking is true. When blocking is false, it takes the lock only if that can be done immediately. TIMEOUT_MAX is the maximum value allowed for the timeout parameter. A greater timeout raises OverflowError.

## See also

- [python-threading](https://iinventedlight.com/library/notes/python-threading/)
- [python-sys](https://iinventedlight.com/library/notes/python-sys/)
- [python-concurrent-futures](https://iinventedlight.com/library/notes/python-concurrent-futures/)

## Claims

- id: C1
  claim: _thread offers low-level primitives for working with multiple threads.
  source: S1
  evidence: "low-level primitives for working with multiple threads"

- id: C2
  claim: threading is the easier, higher-level API built on this module.
  source: S2
  evidence: "easier to use and higher-level"

- id: C3
  claim: start_new_thread starts a thread and returns its identifier.
  source: S2
  evidence: "Start a new thread and return its identifier"

## Sources

- [S1] _thread — Low-level threading API. Python Software Foundation. https://docs.python.org/3/library/_thread.html . License: PSF License Version 2. Accessed 2026-11-27.

- [S2] _thread documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/_thread.rst . License: PSF License Version 2. Accessed 2026-11-27.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, _thread — Low-level threading API; CPython, _thread documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
