def start_them_all() -> None:
    print(f'Start all components in child processes. Parent process id is {os.getpid()}.')
    processes = {'action': multiprocessing.Process(target=start_action_server), 'presenter': multiprocessing.Process(target=start_presenter_server)}
    for process in processes.values():
        process.start()

    def sigterm_handler(signalnum: int, current_stack_frame: Any) -> None:
        strsignal = signal.strsignal
        print(f'Parent process {os.getpid()} received {strsignal(signalnum)} signal. Terminate all child processes first.')
        for child in multiprocessing.active_children():
            child.terminate()
            child.join()
        print(f'Parent process {os.getpid()} terminated successfully.')
        sys.exit(0)
    signal.signal(signal.SIGTERM, sigterm_handler)
    signal.signal(signal.SIGINT, sigterm_handler)
    while True:
        for (name, process) in processes.items():
            if (not process.is_alive()):
                process.join()
                print(f'Component {name} terminated. Terminate all other components now.')
                for (other_name, other_process) in processes.items():
                    if (name != other_name):
                        other_process.terminate()
                        other_process.join()
                print('Parent process terminated.')
                sys.exit(1)
        time.sleep(0.1)
def start_them_all() -> None:
    print(f'Start all components in child processes. Parent process id is {os.getpid()}.')
    processes = {'action': multiprocessing.Process(target=start_action_server), 'presenter': multiprocessing.Process(target=start_presenter_server)}
    for process in processes.values():
        process.start()

    def sigterm_handler(signalnum: int, current_stack_frame: Any) -> None:
        strsignal = signal.strsignal
        print(f'Parent process {os.getpid()} received {strsignal(signalnum)} signal. Terminate all child processes first.')
        for child in multiprocessing.active_children():
            child.terminate()
            child.join()
        print(f'Parent process {os.getpid()} terminated successfully.')
        sys.exit(0)
    signal.signal(signal.SIGTERM, sigterm_handler)
    signal.signal(signal.SIGINT, sigterm_handler)
    while True:
        for (name, process) in processes.items():
            if (not process.is_alive()):
                process.join()
                print(f'Component {name} terminated. Terminate all other components now.')
                for (other_name, other_process) in processes.items():
                    if (name != other_name):
                        other_process.terminate()
                        other_process.join()
                print('Parent process terminated.')
                sys.exit(1)
        time.sleep(0.1)