summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-05-05 18:27:47 (GMT)
committerGitHub <noreply@github.com>2020-05-05 18:27:47 (GMT)
commit7be4e350aadf93c4be5c97b7291d0db2b6bc1dc4 (patch)
tree7285b6051ef96253ce4ef2ac2a34412fae9ea281 /Include
parent0dd5e7a718997da2026ed64fe054dc36cae4fee7 (diff)
downloadcpython-7be4e350aadf93c4be5c97b7291d0db2b6bc1dc4.zip
cpython-7be4e350aadf93c4be5c97b7291d0db2b6bc1dc4.tar.gz
cpython-7be4e350aadf93c4be5c97b7291d0db2b6bc1dc4.tar.bz2
bpo-40513: Per-interpreter GIL (GH-19943)
In the experimental isolated subinterpreters build mode, the GIL is now per-interpreter. Move gil from _PyRuntimeState.ceval to PyInterpreterState.ceval. new_interpreter() always get the config from the main interpreter.
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_ceval.h4
-rw-r--r--Include/internal/pycore_interp.h3
-rw-r--r--Include/internal/pycore_runtime.h2
3 files changed, 9 insertions, 0 deletions
diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h
index 18c8f02..3689900 100644
--- a/Include/internal/pycore_ceval.h
+++ b/Include/internal/pycore_ceval.h
@@ -50,7 +50,11 @@ extern PyObject *_PyEval_EvalCode(
PyObject *kwdefs, PyObject *closure,
PyObject *name, PyObject *qualname);
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+extern int _PyEval_ThreadsInitialized(PyInterpreterState *interp);
+#else
extern int _PyEval_ThreadsInitialized(struct pyruntimestate *runtime);
+#endif
extern PyStatus _PyEval_InitGIL(PyThreadState *tstate);
extern void _PyEval_FiniGIL(PyThreadState *tstate);
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index 5bf8998..26e7a47 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -46,6 +46,9 @@ struct _ceval_state {
/* Request for dropping the GIL */
_Py_atomic_int gil_drop_request;
struct _pending_calls pending;
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+ struct _gil_runtime_state gil;
+#endif
};
diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h
index 34eb492..ebdc12b 100644
--- a/Include/internal/pycore_runtime.h
+++ b/Include/internal/pycore_runtime.h
@@ -19,7 +19,9 @@ struct _ceval_runtime_state {
the main thread of the main interpreter can handle signals: see
_Py_ThreadCanHandleSignals(). */
_Py_atomic_int signals_pending;
+#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
struct _gil_runtime_state gil;
+#endif
};
/* GIL state */