mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
gh-99113: A Per-Interpreter GIL! (gh-104210)
This is the culmination of PEP 684 (and of my 8-year long multi-core Python project)! Each subinterpreter may now be created with its own GIL (via Py_NewInterpreterFromConfig()). If not so configured then the interpreter will share with the main interpreter--the status quo since subinterpreters were added decades ago. The main interpreter always has its own GIL and subinterpreters from Py_NewInterpreter() will always share with the main interpreter.
This commit is contained in:
parent
942482c8e6
commit
5c9ee498c6
7 changed files with 24 additions and 52 deletions
|
@ -425,8 +425,6 @@ init_runtime(_PyRuntimeState *runtime,
|
|||
runtime->open_code_userdata = open_code_userdata;
|
||||
runtime->audit_hook_head = audit_hook_head;
|
||||
|
||||
_PyEval_InitRuntimeState(&runtime->ceval);
|
||||
|
||||
PyPreConfig_InitPythonConfig(&runtime->preconfig);
|
||||
|
||||
PyThread_type_lock *lockptrs[NUMLOCKS] = {
|
||||
|
@ -682,7 +680,7 @@ init_interpreter(PyInterpreterState *interp,
|
|||
memcpy(&interp->obmalloc.pools.used, temp, sizeof(temp));
|
||||
}
|
||||
|
||||
_PyEval_InitState(&interp->ceval, pending_lock);
|
||||
_PyEval_InitState(interp, pending_lock);
|
||||
_PyGC_InitState(&interp->gc);
|
||||
PyConfig_InitPythonConfig(&interp->config);
|
||||
_PyType_InitCache(interp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue