summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-03-21 18:21:02 (GMT)
committerGitHub <noreply@github.com>2024-03-21 18:21:02 (GMT)
commit1f72fb5447ef3f8892b4a7a6213522579c618e8e (patch)
tree43997f5d50ff319adc557320b277a68ddf38099d /Include
parent50369e6c34d05222e5a0ec9443a9f7b230e83112 (diff)
downloadcpython-1f72fb5447ef3f8892b4a7a6213522579c618e8e.zip
cpython-1f72fb5447ef3f8892b4a7a6213522579c618e8e.tar.gz
cpython-1f72fb5447ef3f8892b4a7a6213522579c618e8e.tar.bz2
gh-116522: Refactor `_PyThreadState_DeleteExcept` (#117131)
Split `_PyThreadState_DeleteExcept` into two functions: - `_PyThreadState_RemoveExcept` removes all thread states other than one passed as an argument. It returns the removed thread states as a linked list. - `_PyThreadState_DeleteList` deletes those dead thread states. It may call destructors, so we want to "start the world" before calling `_PyThreadState_DeleteList` to avoid potential deadlocks.
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_pystate.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h
index 9aa4392..35e266a 100644
--- a/Include/internal/pycore_pystate.h
+++ b/Include/internal/pycore_pystate.h
@@ -218,7 +218,8 @@ extern PyThreadState * _PyThreadState_New(
PyInterpreterState *interp,
int whence);
extern void _PyThreadState_Bind(PyThreadState *tstate);
-extern void _PyThreadState_DeleteExcept(PyThreadState *tstate);
+extern PyThreadState * _PyThreadState_RemoveExcept(PyThreadState *tstate);
+extern void _PyThreadState_DeleteList(PyThreadState *list);
extern void _PyThreadState_ClearMimallocHeaps(PyThreadState *tstate);
// Export for '_testinternalcapi' shared extension