mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
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:
parent
8262c96bcc
commit
313f92a57b
8 changed files with 42 additions and 40 deletions
|
@ -1,4 +1,4 @@
|
|||
#include "pycore_interp.h" // _PyInterpreterState.pythread_stacksize
|
||||
#include "pycore_interp.h" // _PyInterpreterState.threads.stacksize
|
||||
|
||||
/* This code implemented by Dag.Gruneau@elsa.preseco.comm.se */
|
||||
/* Fast NonRecursiveMutex support by Yakov Markovitch, markovitch@iso.ru */
|
||||
|
@ -199,7 +199,7 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
|
|||
obj->func = func;
|
||||
obj->arg = arg;
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
size_t stacksize = tstate ? tstate->interp->pythread_stacksize : 0;
|
||||
size_t stacksize = tstate ? tstate->interp->threads.stacksize : 0;
|
||||
hThread = (HANDLE)_beginthreadex(0,
|
||||
Py_SAFE_DOWNCAST(stacksize, Py_ssize_t, unsigned int),
|
||||
bootstrap, obj,
|
||||
|
@ -376,13 +376,13 @@ _pythread_nt_set_stacksize(size_t size)
|
|||
{
|
||||
/* set to default */
|
||||
if (size == 0) {
|
||||
_PyInterpreterState_GET()->pythread_stacksize = 0;
|
||||
_PyInterpreterState_GET()->threads.stacksize = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* valid range? */
|
||||
if (size >= THREAD_MIN_STACKSIZE && size < THREAD_MAX_STACKSIZE) {
|
||||
_PyInterpreterState_GET()->pythread_stacksize = size;
|
||||
_PyInterpreterState_GET()->threads.stacksize = size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue