summaryrefslogtreecommitdiffstats
path: root/Python/thread_nt.h
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2017-09-06 01:26:16 (GMT)
committerGitHub <noreply@github.com>2017-09-06 01:26:16 (GMT)
commit76d5abc8684bac4f2fc7cccfe2cd940923357351 (patch)
tree4ae6a3bd88bef1266a8d9723c589f925d90bf848 /Python/thread_nt.h
parent501b324d3a940d26e0021a38aae8d896a30fbcff (diff)
downloadcpython-76d5abc8684bac4f2fc7cccfe2cd940923357351.zip
cpython-76d5abc8684bac4f2fc7cccfe2cd940923357351.tar.gz
cpython-76d5abc8684bac4f2fc7cccfe2cd940923357351.tar.bz2
bpo-30860: Consolidate stateful runtime globals. (#2594)
* group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
Diffstat (limited to 'Python/thread_nt.h')
-rw-r--r--Python/thread_nt.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/Python/thread_nt.h b/Python/thread_nt.h
index 47eb4b6..2f3a71b 100644
--- a/Python/thread_nt.h
+++ b/Python/thread_nt.h
@@ -189,9 +189,10 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
return PYTHREAD_INVALID_THREAD_ID;
obj->func = func;
obj->arg = arg;
+ PyThreadState *tstate = PyThreadState_GET();
+ size_t stacksize = tstate ? tstate->interp->pythread_stacksize : 0;
hThread = (HANDLE)_beginthreadex(0,
- Py_SAFE_DOWNCAST(_pythread_stacksize,
- Py_ssize_t, unsigned int),
+ Py_SAFE_DOWNCAST(stacksize, Py_ssize_t, unsigned int),
bootstrap, obj,
0, &threadID);
if (hThread == 0) {
@@ -332,13 +333,13 @@ _pythread_nt_set_stacksize(size_t size)
{
/* set to default */
if (size == 0) {
- _pythread_stacksize = 0;
+ PyThreadState_GET()->interp->pythread_stacksize = 0;
return 0;
}
/* valid range? */
if (size >= THREAD_MIN_STACKSIZE && size < THREAD_MAX_STACKSIZE) {
- _pythread_stacksize = size;
+ PyThreadState_GET()->interp->pythread_stacksize = size;
return 0;
}