mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
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.
This commit is contained in:
parent
0dd5e7a718
commit
7be4e350aa
6 changed files with 82 additions and 5 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue