mirror of
https://github.com/python/cpython.git
synced 2025-09-08 18:01:44 +00:00
gh-59956: Clarify GILState-related Code (gh-101161)
The objective of this change is to help make the GILState-related code easier to understand. This mostly involves moving code around and some semantically equivalent refactors. However, there are a also a small number of slight changes in structure and behavior: * tstate_current is moved out of _PyRuntimeState.gilstate * autoTSSkey is moved out of _PyRuntimeState.gilstate * autoTSSkey is initialized earlier * autoTSSkey is re-initialized (after fork) earlier https://github.com/python/cpython/issues/59956
This commit is contained in:
parent
8a2d4f4e8e
commit
6036c3e856
10 changed files with 373 additions and 250 deletions
|
@ -587,7 +587,7 @@ PyOS_AfterFork_Child(void)
|
|||
PyStatus status;
|
||||
_PyRuntimeState *runtime = &_PyRuntime;
|
||||
|
||||
status = _PyGILState_Reinit(runtime);
|
||||
status = _PyRuntimeState_ReInitThreads(runtime);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
goto fatal_error;
|
||||
}
|
||||
|
@ -611,11 +611,6 @@ PyOS_AfterFork_Child(void)
|
|||
|
||||
_PySignal_AfterFork();
|
||||
|
||||
status = _PyRuntimeState_ReInitThreads(runtime);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
goto fatal_error;
|
||||
}
|
||||
|
||||
status = _PyInterpreterState_DeleteExceptMain(runtime);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
goto fatal_error;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue