def _try_join_cancelled_thread ( thread ) : thread . join ( 10 ) if thread . is_alive ( ) : logging . warning ( "Thread %s did not terminate within grace period after cancellation" , thread . name )
kill a thread after join in python
Join a thread but if the thread doesn t terminate for some time ignore it instead of waiting infinitely .
def _try_join_cancelled_thread(thread):
    """Join a thread, but if the thread doesn't terminate for some time, ignore it
    instead of waiting infinitely."""
    thread.join(10)
    if thread.is_alive():
        logging.warning("Thread %s did not terminate within grace period after cancellation",
                        thread.name)