[Python-checkins] cpython (3.4): check if the thread is finalizing after retaking the GIL
benjamin.peterson
python-checkins at python.org
Tue Jun 17 08:08:50 CEST 2014
http://hg.python.org/cpython/rev/d1d1ed421717
changeset: 91231:d1d1ed421717
branch: 3.4
parent: 91227:b58a80a44909
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
@@ -1267,6 +1267,13 @@
/* Other threads may run now */
take_gil(tstate);
+
+ /* Check if we should make a quick exit. */
+ if (_Py_Finalizing && _Py_Finalizing != tstate) {
+ drop_gil(tstate);
+ 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