summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2021-12-07 21:03:47 (GMT)
committerGitHub <noreply@github.com>2021-12-07 21:03:47 (GMT)
commit313f92a57bc3887026ec16adb536bb2b7580ce47 (patch)
tree65ddd994ed926fb46d2c24628b94f24667f6f385 /Include/internal
parent8262c96bcc1841188866c1b022d9087e89639d98 (diff)
downloadcpython-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 'Include/internal')
-rw-r--r--Include/internal/pycore_interp.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index f52ee59..53938e3 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -238,7 +238,19 @@ struct type_cache {
struct _is {
struct _is *next;
- struct _ts *tstate_head;
+
+ struct pythreads {
+ int _preallocated_used;
+ uint64_t next_unique_id;
+ struct _ts *head;
+ /* Used in Modules/_threadmodule.c. */
+ long count;
+ /* Support for runtime thread stack size tuning.
+ A value of 0 means using the platform's default stack size
+ or the size specified by the THREAD_STACK_SIZE macro. */
+ /* Used in Python/thread.c. */
+ size_t stacksize;
+ } threads;
/* Reference to the _PyRuntime global variable. This field exists
to not have to pass runtime in addition to tstate to a function.
@@ -268,14 +280,6 @@ struct _is {
// (-1: "off", 1: "on", 0: no override)
int override_frozen_modules;
- /* Used in Modules/_threadmodule.c. */
- long num_threads;
- /* Support for runtime thread stack size tuning.
- A value of 0 means using the platform's default stack size
- or the size specified by the THREAD_STACK_SIZE macro. */
- /* Used in Python/thread.c. */
- size_t pythread_stacksize;
-
PyObject *codec_search_path;
PyObject *codec_search_cache;
PyObject *codec_error_registry;
@@ -302,8 +306,6 @@ struct _is {
PyObject *after_forkers_child;
#endif
- uint64_t tstate_next_unique_id;
-
struct _warnings_runtime_state warnings;
struct atexit_state atexit;