diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2021-12-07 21:03:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-07 21:03:47 (GMT) |
commit | 313f92a57bc3887026ec16adb536bb2b7580ce47 (patch) | |
tree | 65ddd994ed926fb46d2c24628b94f24667f6f385 /Modules | |
parent | 8262c96bcc1841188866c1b022d9087e89639d98 (diff) | |
download | cpython-313f92a57bc3887026ec16adb536bb2b7580ce47.zip cpython-313f92a57bc3887026ec16adb536bb2b7580ce47.tar.gz cpython-313f92a57bc3887026ec16adb536bb2b7580ce47.tar.bz2 |
bpo-46008: Move thread-related interpreter state into a sub-struct. (gh-29971)
This parallels _PyRuntimeState.interpreters. Doing this helps make it more clear what part of PyInterpreterState relates to its threads.
https://bugs.python.org/issue46008
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_threadmodule.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index 39b116a..2ba081d 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -3,7 +3,7 @@ /* Interface to Sjoerd's portable C thread library */ #include "Python.h" -#include "pycore_interp.h" // _PyInterpreterState.num_threads +#include "pycore_interp.h" // _PyInterpreterState.threads.count #include "pycore_moduleobject.h" // _PyModule_GetState() #include "pycore_pylifecycle.h" #include "pycore_pystate.h" // _PyThreadState_Init() @@ -1089,7 +1089,7 @@ thread_run(void *boot_raw) #endif _PyThreadState_Init(tstate); PyEval_AcquireThread(tstate); - tstate->interp->num_threads++; + tstate->interp->threads.count++; PyObject *res = PyObject_Call(boot->func, boot->args, boot->kwargs); if (res == NULL) { @@ -1105,7 +1105,7 @@ thread_run(void *boot_raw) } thread_bootstate_free(boot); - tstate->interp->num_threads--; + tstate->interp->threads.count--; PyThreadState_Clear(tstate); _PyThreadState_DeleteCurrent(tstate); @@ -1279,7 +1279,7 @@ static PyObject * thread__count(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyInterpreterState *interp = _PyInterpreterState_GET(); - return PyLong_FromLong(interp->num_threads); + return PyLong_FromLong(interp->threads.count); } PyDoc_STRVAR(_count_doc, |