diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-05-05 19:23:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-05 19:23:00 (GMT) |
commit | 55671fe04700ccb4e73c8db3dd1e9c031dafe700 (patch) | |
tree | 88902724b881874e7c45b6c8386c7e9a9e9c0d58 /Include/internal | |
parent | d00d94214971621e6a3541425ee8c8072023ca1a (diff) | |
download | cpython-55671fe04700ccb4e73c8db3dd1e9c031dafe700.zip cpython-55671fe04700ccb4e73c8db3dd1e9c031dafe700.tar.gz cpython-55671fe04700ccb4e73c8db3dd1e9c031dafe700.tar.bz2 |
gh-99113: Share the GIL via PyInterpreterState.ceval.gil (gh-104203)
In preparation for a per-interpreter GIL, we add PyInterpreterState.ceval.gil, set it to the shared GIL for each interpreter, and use that rather than using _PyRuntime.ceval.gil directly. Note that _PyRuntime.ceval.gil is still the actual GIL.
Diffstat (limited to 'Include/internal')
-rw-r--r-- | Include/internal/pycore_ceval.h | 2 | ||||
-rw-r--r-- | Include/internal/pycore_ceval_state.h | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h index deda070..0bbc9ef 100644 --- a/Include/internal/pycore_ceval.h +++ b/Include/internal/pycore_ceval.h @@ -96,7 +96,7 @@ _PyEval_Vector(PyThreadState *tstate, PyObject* const* args, size_t argcount, PyObject *kwnames); -extern int _PyEval_ThreadsInitialized(struct pyruntimestate *runtime); +extern int _PyEval_ThreadsInitialized(void); extern PyStatus _PyEval_InitGIL(PyThreadState *tstate); extern void _PyEval_FiniGIL(PyInterpreterState *interp); diff --git a/Include/internal/pycore_ceval_state.h b/Include/internal/pycore_ceval_state.h index 9ba42eb..1a00ec8 100644 --- a/Include/internal/pycore_ceval_state.h +++ b/Include/internal/pycore_ceval_state.h @@ -49,6 +49,8 @@ struct _ceval_runtime_state { the main thread of the main interpreter can handle signals: see _Py_ThreadCanHandleSignals(). */ _Py_atomic_int signals_pending; + + /* This is (only) used indirectly through PyInterpreterState.ceval.gil. */ struct _gil_runtime_state gil; }; @@ -83,6 +85,7 @@ struct _pending_calls { struct _ceval_state { int recursion_limit; + struct _gil_runtime_state *gil; /* This single variable consolidates all requests to break out of the fast path in the eval loop. */ _Py_atomic_int eval_breaker; |