cpython: Issue #11393: New try to fix faulthandler_thread()
http://hg.python.org/cpython/rev/0fb0fbd442b4 changeset: 69096:0fb0fbd442b4 user: Victor Stinner <victor.stinner@haypocalc.com> date: Fri Apr 01 03:00:05 2011 +0200 summary: Issue #11393: New try to fix faulthandler_thread() Always release the cancel join. Fix also another corner case: _PyFaulthandler_Fini() called after setting running variable to zero, but before releasing the join lock. files: Modules/faulthandler.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -401,7 +401,6 @@ thread.timeout_ms, 0); if (st == PY_LOCK_ACQUIRED) { /* Cancelled by user */ - PyThread_release_lock(thread.cancel_event); break; } /* Timeout => dump traceback */ @@ -418,8 +417,9 @@ } while (ok && thread.repeat); /* The only way out */ + PyThread_release_lock(thread.cancel_event); + PyThread_release_lock(thread.join_event); thread.running = 0; - PyThread_release_lock(thread.join_event); } static void @@ -428,11 +428,11 @@ if (thread.running) { /* Notify cancellation */ PyThread_release_lock(thread.cancel_event); - /* Wait for thread to join */ - PyThread_acquire_lock(thread.join_event, 1); - assert(thread.running == 0); - PyThread_release_lock(thread.join_event); } + /* Wait for thread to join */ + PyThread_acquire_lock(thread.join_event, 1); + assert(thread.running == 0); + PyThread_release_lock(thread.join_event); Py_CLEAR(thread.file); } -- Repository URL: http://hg.python.org/cpython
participants (1)
-
victor.stinner