mirror of
https://github.com/python/cpython.git
synced 2025-10-31 21:51:50 +00:00
bpo-36333, bpo-36356: Fix _PyEval_FiniThreads() (GH-12432)
_PyEval_FiniThreads() now free the pending lock.
This commit is contained in:
parent
29198ea1c6
commit
a712679a2b
1 changed files with 11 additions and 2 deletions
|
|
@ -169,8 +169,10 @@ PyEval_ThreadsInitialized(void)
|
||||||
void
|
void
|
||||||
PyEval_InitThreads(void)
|
PyEval_InitThreads(void)
|
||||||
{
|
{
|
||||||
if (gil_created())
|
if (gil_created()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PyThread_init_thread();
|
PyThread_init_thread();
|
||||||
create_gil();
|
create_gil();
|
||||||
take_gil(_PyThreadState_GET());
|
take_gil(_PyThreadState_GET());
|
||||||
|
|
@ -184,10 +186,17 @@ PyEval_InitThreads(void)
|
||||||
void
|
void
|
||||||
_PyEval_FiniThreads(void)
|
_PyEval_FiniThreads(void)
|
||||||
{
|
{
|
||||||
if (!gil_created())
|
if (!gil_created()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
destroy_gil();
|
destroy_gil();
|
||||||
assert(!gil_created());
|
assert(!gil_created());
|
||||||
|
|
||||||
|
if (_PyRuntime.ceval.pending.lock != NULL) {
|
||||||
|
PyThread_free_lock(_PyRuntime.ceval.pending.lock);
|
||||||
|
_PyRuntime.ceval.pending.lock = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue