cpython: 3558eecd84f0 (original) (raw)
Mercurial > cpython
changeset 69097:3558eecd84f0
Issue #11393: fix usage of locks in faulthandler * faulthandler_cancel_dump_tracebacks_later() is responsible to set running to zero (so we don't need the volatile keyword anymore) * release locks if PyThread_start_new_thread() fails assert(thread.running == 0) was wrong in a corner case [#11393]
Victor Stinner victor.stinner@haypocalc.com | |
---|---|
date | Fri, 01 Apr 2011 03:16:51 +0200 |
parents | 0fb0fbd442b4 |
children | 214d0608fb84 |
files | Modules/faulthandler.c |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-)[+] [-] Modules/faulthandler.c 7 |
line wrap: on
line diff
--- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -48,7 +48,7 @@ static struct { int fd; PY_TIMEOUT_T timeout_ms; /* timeout in microseconds */ int repeat;
- int running; PyInterpreterState interp; int exit; / released by parent thread when cancel request */ @@ -419,7 +419,6 @@ faulthandler_thread(void unused) / The only way out */ PyThread_release_lock(thread.cancel_event); PyThread_release_lock(thread.join_event);
} static void @@ -431,8 +430,8 @@ faulthandler_cancel_dump_tracebacks_late } /* Wait for thread to join */ PyThread_acquire_lock(thread.join_event, 1);
@@ -486,6 +485,8 @@ faulthandler_dump_traceback_later(PyObje thread.running = 1; if (PyThread_start_new_thread(faulthandler_thread, NULL) == -1) { thread.running = 0;
PyThread_release_lock(thread.join_event);[](#l1.34)
PyThread_release_lock(thread.cancel_event);[](#l1.35) Py_CLEAR(thread.file);[](#l1.36) PyErr_SetString(PyExc_RuntimeError,[](#l1.37) "unable to start watchdog thread");[](#l1.38)