def close(self) -> None: super(MultiThreadedRunner, self).close() if self.clock_speed: self.clock_event.set() self.stop_clock_event.set() for thread in self.threads.values(): thread.inbox.put(PromptToQuit()) for thread in self.threads.values(): thread.join(timeout=10) self.threads.clear() self.outboxes.clear() self.inboxes.clear()
def close(self) -> None: super(MultiprocessRunner, self).close() unsubscribe(handler=self.broadcast_prompt, predicate=is_prompt_to_pull) for os_process in self.os_processes: os_process.inbox.put(PromptToQuit()) for os_process in self.os_processes: os_process.join(timeout=10) for os_process in self.os_processes: if os_process.is_alive(): os_process.terminate() self.os_processes.clear()