mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-104341: Adjust tstate_must_exit() to Respect Interpreter Finalization (gh-104437)
With the move to a per-interpreter GIL, this check slipped through the cracks.
This commit is contained in:
parent
cb88ae635e
commit
26baa747c2
11 changed files with 56 additions and 10 deletions
|
|
@ -83,6 +83,13 @@ struct _is {
|
|||
int _initialized;
|
||||
int finalizing;
|
||||
|
||||
/* Set by Py_EndInterpreter().
|
||||
|
||||
Use _PyInterpreterState_GetFinalizing()
|
||||
and _PyInterpreterState_SetFinalizing()
|
||||
to access it, don't access it directly. */
|
||||
_Py_atomic_address _finalizing;
|
||||
|
||||
struct _obmalloc_state obmalloc;
|
||||
|
||||
struct _ceval_state ceval;
|
||||
|
|
@ -191,6 +198,17 @@ struct _is {
|
|||
extern void _PyInterpreterState_Clear(PyThreadState *tstate);
|
||||
|
||||
|
||||
static inline PyThreadState*
|
||||
_PyInterpreterState_GetFinalizing(PyInterpreterState *interp) {
|
||||
return (PyThreadState*)_Py_atomic_load_relaxed(&interp->_finalizing);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_PyInterpreterState_SetFinalizing(PyInterpreterState *interp, PyThreadState *tstate) {
|
||||
_Py_atomic_store_relaxed(&interp->_finalizing, (uintptr_t)tstate);
|
||||
}
|
||||
|
||||
|
||||
/* cross-interpreter data registry */
|
||||
|
||||
/* For now we use a global registry of shareable classes. An
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue