INNER CODE UNIT · Python

exit_graceful

shakedzy/companion · companion.py:432

def exit_graceful(signum, frame) -> None:
    """
    Stop threads when app terminates.

    :param signum: required by `signal.signal`
    :param frame: required by `signal.signal`
    """
    app_cache.stop_threads_event.set()
    if app_cache.text2speech_thread is not None:
        app_cache.text2speech_thread.join()
    sys.exit(0)


def restart() -> None:
    """
    Restart app
    """
    global config

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…