Browse Source
bpo-36333, bpo-36356: Fix _PyEval_FiniThreads() (GH-12432)
_PyEval_FiniThreads() now free the pending lock.
pull/12435/head
Victor Stinner
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
11 additions and
2 deletions
-
Python/ceval.c
|
|
|
@ -169,8 +169,10 @@ PyEval_ThreadsInitialized(void) |
|
|
|
void |
|
|
|
PyEval_InitThreads(void) |
|
|
|
{ |
|
|
|
if (gil_created()) |
|
|
|
if (gil_created()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
PyThread_init_thread(); |
|
|
|
create_gil(); |
|
|
|
take_gil(_PyThreadState_GET()); |
|
|
|
@ -184,10 +186,17 @@ PyEval_InitThreads(void) |
|
|
|
void |
|
|
|
_PyEval_FiniThreads(void) |
|
|
|
{ |
|
|
|
if (!gil_created()) |
|
|
|
if (!gil_created()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
destroy_gil(); |
|
|
|
assert(!gil_created()); |
|
|
|
|
|
|
|
if (_PyRuntime.ceval.pending.lock != NULL) { |
|
|
|
PyThread_free_lock(_PyRuntime.ceval.pending.lock); |
|
|
|
_PyRuntime.ceval.pending.lock = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void |
|
|
|
|