summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-04-29 09:15:56 (GMT)
committerGitHub <noreply@github.com>2019-04-29 09:15:56 (GMT)
commitb36e5d627d4232a01850707eb78a5067f3fd77f4 (patch)
tree63eb8a0966e7ac1b721f8de5c877d4bc79c6fa58 /Python/ceval.c
parent7a5a1cfe04892351bba8e8d7d21ae2262fa35b67 (diff)
downloadcpython-b36e5d627d4232a01850707eb78a5067f3fd77f4.zip
cpython-b36e5d627d4232a01850707eb78a5067f3fd77f4.tar.gz
cpython-b36e5d627d4232a01850707eb78a5067f3fd77f4.tar.bz2
bpo-36356: Destroy the GIL at exit (GH-12453)
* Add _PyEval_FiniThreads2(). _PyEval_FiniThreads() now only clears the pending lock, whereas _PyEval_FiniThreads2() destroys the GIL. * pymain_free() now calls _PyEval_FiniThreads2(). * Py_FinalizeEx() now calls _PyEval_FiniThreads().
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index ccd0427..5480fba 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -188,20 +188,26 @@ PyEval_InitThreads(void)
}
}
+
void
_PyEval_FiniThreads(void)
{
+ if (_PyRuntime.ceval.pending.lock != NULL) {
+ PyThread_free_lock(_PyRuntime.ceval.pending.lock);
+ _PyRuntime.ceval.pending.lock = NULL;
+ }
+}
+
+
+void
+_PyEval_FiniThreads2(void)
+{
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;
- }
}
static inline void