SIGN IN SIGN UP

faulthandler: one more time, fix usage of locks in the watchdog thread

* Write a new test to ensure that dump_tracebacks_later() still works if
   it was already called and then cancelled before
 * Don't use a variable to check the status of the thread, only rely on locks
 * The thread only releases cancel_event if it was able to acquire it (if
   the timer was interrupted)
 * The main thread always hold this lock. It is only released when
   faulthandler_thread() is interrupted until this thread exits, or at Python
   exit.
V
Victor Stinner committed
de10f4054b6bd6dd286559d7bbaaff7364282fc7
Parent: cfa7123