]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-116522: Refactor `_PyThreadState_DeleteExcept` (#117131)
authorSam Gross <colesbury@gmail.com>
Thu, 21 Mar 2024 18:21:02 +0000 (14:21 -0400)
committerGitHub <noreply@github.com>
Thu, 21 Mar 2024 18:21:02 +0000 (11:21 -0700)
commit1f72fb5447ef3f8892b4a7a6213522579c618e8e
tree43997f5d50ff319adc557320b277a68ddf38099d
parent50369e6c34d05222e5a0ec9443a9f7b230e83112
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.
Include/internal/pycore_pystate.h
Modules/posixmodule.c
Python/ceval_gil.c
Python/pylifecycle.c
Python/pystate.c