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
This commit is contained in:
Eric Snow 2021-12-07 14:03:47 -07:00 committed by GitHub
parent 8262c96bcc
commit 313f92a57b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 40 deletions

View file

@ -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;