Main.startを簡素化し、受信/ハンドラスレッドの起動を削除してメインループで稼働を維持。KeyboardInterruptでstopを呼び出すように変更
This commit is contained in:
@@ -551,9 +551,12 @@ class Main:
|
||||
self._threads.append(th_handler)
|
||||
|
||||
def start(self) -> None:
|
||||
"""Start receiver and handler threads."""
|
||||
self.startReceiver()
|
||||
self.startHandler()
|
||||
"""Start the main loop to keep the program running."""
|
||||
try:
|
||||
while not self._stop_event.is_set():
|
||||
time.sleep(1)
|
||||
except KeyboardInterrupt:
|
||||
self.stop()
|
||||
|
||||
def stop(self, wait: float = 2.0) -> None:
|
||||
"""Signal threads to stop and wait for them to finish.
|
||||
|
||||
Reference in New Issue
Block a user