diff options
-rw-r--r-- | Python/pystate.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index 85a9ce7..0651ab0 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -40,8 +40,10 @@ PyInterpreterState_New(void) interp->checkinterval = 10; interp->tstate_head = NULL; + HEAD_LOCK(); interp->next = interp_head; interp_head = interp; + HEAD_UNLOCK(); } return interp; @@ -79,6 +81,7 @@ PyInterpreterState_Delete(PyInterpreterState *interp) { PyInterpreterState **p; zapthreads(interp); + HEAD_LOCK(); for (p = &interp_head; ; p = &(*p)->next) { if (*p == NULL) Py_FatalError( @@ -89,6 +92,7 @@ PyInterpreterState_Delete(PyInterpreterState *interp) if (interp->tstate_head != NULL) Py_FatalError("PyInterpreterState_Delete: remaining threads"); *p = interp->next; + HEAD_UNLOCK(); PyMem_DEL(interp); } |