diff options
author | Sam Gross <colesbury@gmail.com> | 2024-01-23 18:08:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-23 18:08:23 (GMT) |
commit | 441affc9e7f419ef0b68f734505fa2f79fe653c7 (patch) | |
tree | 1c7771190fffc7927ab70f485500521a96de7938 /Include/cpython | |
parent | 5f1997896d9c3ecf92e9863177c452b468a6a2c8 (diff) | |
download | cpython-441affc9e7f419ef0b68f734505fa2f79fe653c7.zip cpython-441affc9e7f419ef0b68f734505fa2f79fe653c7.tar.gz cpython-441affc9e7f419ef0b68f734505fa2f79fe653c7.tar.bz2 |
gh-111964: Implement stop-the-world pauses (gh-112471)
The `--disable-gil` builds occasionally need to pause all but one thread. Some
examples include:
* Cyclic garbage collection, where this is often called a "stop the world event"
* Before calling `fork()`, to ensure a consistent state for internal data structures
* During interpreter shutdown, to ensure that daemon threads aren't accessing Python objects
This adds the following functions to implement global and per-interpreter pauses:
* `_PyEval_StopTheWorldAll()` and `_PyEval_StartTheWorldAll()` (for the global runtime)
* `_PyEval_StopTheWorld()` and `_PyEval_StartTheWorld()` (per-interpreter)
(The function names may change.)
These functions are no-ops outside of the `--disable-gil` build.
Diffstat (limited to 'Include/cpython')
-rw-r--r-- | Include/cpython/pystate.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h index 1091394..60b056b 100644 --- a/Include/cpython/pystate.h +++ b/Include/cpython/pystate.h @@ -102,7 +102,7 @@ struct _ts { #endif int _whence; - /* Thread state (_Py_THREAD_ATTACHED, _Py_THREAD_DETACHED, _Py_THREAD_GC). + /* Thread state (_Py_THREAD_ATTACHED, _Py_THREAD_DETACHED, _Py_THREAD_SUSPENDED). See Include/internal/pycore_pystate.h for more details. */ int state; |