[Python-checkins] cpython (2.7): check if the thread is finalizing after retaking the GIL

benjamin.peterson python-checkins at python.org
Tue Jun 17 08:08:49 CEST 2014


http://hg.python.org/cpython/rev/0432b0d99175
changeset: 91230:0432b0d99175
branch: 2.7
user: Benjamin Peterson <benjamin at python.org>
date: Mon Jun 16 22:59:07 2014 -0700
summary:
 check if the thread is finalizing after retaking the GIL
files:
 Python/ceval.c | 7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1024,6 +1024,13 @@
 /* Other threads may run now */
 
 PyThread_acquire_lock(interpreter_lock, 1);
+
+ /* Check if we should make a quick exit. */
+ if (_Py_Finalizing && _Py_Finalizing != tstate) {
+ PyThread_release_lock(interpreter_lock);
+ PyThread_exit_thread();
+ }
+
 if (PyThreadState_Swap(tstate) != NULL)
 Py_FatalError("ceval: orphan tstate");
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /