mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
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.
This commit is contained in:
parent
50369e6c34
commit
1f72fb5447
5 changed files with 41 additions and 23 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue