mirror of
https://github.com/python/cpython.git
synced 2025-10-07 07:31:46 +00:00
bpo-39984: _PyThreadState_DeleteCurrent() takes tstate (GH-19051)
* _PyThreadState_DeleteCurrent() now takes tstate rather than runtime. * Add ensure_tstate_not_null() helper to pystate.c. * Add _PyEval_ReleaseLock() function. * _PyThreadState_DeleteCurrent() now calls _PyEval_ReleaseLock(tstate) and frees PyThreadState memory after this call, not before. * PyGILState_Release(): rename "tcur" variable to "tstate".
This commit is contained in:
parent
d7fabc1162
commit
23ef89db7a
6 changed files with 47 additions and 32 deletions
|
@ -193,7 +193,8 @@ static void
|
|||
ensure_tstate_not_null(const char *func, PyThreadState *tstate)
|
||||
{
|
||||
if (tstate == NULL) {
|
||||
_Py_FatalErrorFunc(func, "current thread state is NULL");
|
||||
_Py_FatalErrorFunc(func,
|
||||
"current thread state is NULL (released GIL?)");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,6 +314,13 @@ PyEval_ReleaseLock(void)
|
|||
drop_gil(&runtime->ceval, tstate);
|
||||
}
|
||||
|
||||
void
|
||||
_PyEval_ReleaseLock(PyThreadState *tstate)
|
||||
{
|
||||
struct _ceval_runtime_state *ceval = &tstate->interp->runtime->ceval;
|
||||
drop_gil(ceval, tstate);
|
||||
}
|
||||
|
||||
void
|
||||
PyEval_AcquireThread(PyThreadState *tstate)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue