timeout for thread.join

pull/727/head
DJ2LS 2024-05-20 18:42:11 +02:00
parent 43996126fb
commit c9685e3ee1
7 changed files with 15 additions and 12 deletions

View File

@ -38,7 +38,7 @@ def get_audio_devices():
target=fetch_audio_devices, args=(proxy_input_devices, proxy_output_devices)
)
proc.start()
proc.join()
proc.join(3)
# additional logging for audio devices
# log.debug("[AUD] get_audio_devices: input_devices:", list=f"{proxy_input_devices}")

View File

@ -365,4 +365,4 @@ class Demodulator():
print("shutting down demodulators...")
self.shutdown_flag.set()
for mode in self.MODE_DICT:
self.MODE_DICT[mode]['decoding_thread'].join()
self.MODE_DICT[mode]['decoding_thread'].join(3)

View File

@ -43,6 +43,8 @@ class radio:
self.connect()
def connect(self):
print(self.hostname)
print(self.port)
if self.shutdown:
return
try:
@ -350,6 +352,9 @@ class radio:
self.log.info(f"Attempting to start rigctld using binary found at: {binary_path}")
self.rigctld_process = helpers.kill_and_execute(binary_path, additional_args)
self.log.info("Successfully executed rigctld.")
print(self.rigctld_process)
print(additional_args)
print(binary_paths)
break # Exit the loop after successful execution
except Exception as e:
pass

View File

@ -19,7 +19,7 @@ class ScheduleManager:
self.event_manager = event_manager
self.config = self.config_manager.read()
self.scheduler = sched.scheduler(time.time, time.sleep)
self.scheduler = sched.scheduler(time.time, threading.Event().wait)
self.events = {
'check_for_queued_messages': {'function': self.check_for_queued_messages, 'interval': 5},
'explorer_publishing': {'function': self.push_to_explorer, 'interval': 60},
@ -65,7 +65,7 @@ class ScheduleManager:
# Wait for the scheduler thread to finish
if self.scheduler_thread:
self.scheduler_thread.join()
self.scheduler_thread.join(3)
print("done")
def transmit_beacon(self):
try:
@ -100,8 +100,5 @@ class ScheduleManager:
except Exception as e:
print(e)
# let's wait some random time for decreasing chance of packet colission.
threading.Event().wait(np.random.randint(3,10))
return

View File

@ -355,10 +355,11 @@ def stop_server():
if hasattr(app, 'radio_manager'):
app.radio_manager.stop()
import time
start_time = time.time()
if hasattr(app, 'schedule_manager'):
app.schedule_manager.stop()
print(time.time()-start_time)
if hasattr(app, 'service_manager'):
if hasattr(app.service_manager, 'modem_service') and app.service_manager.modem_service:

View File

@ -148,4 +148,4 @@ class SM:
print("shutting down service manager...")
self.modem_service.put("stop")
self.shutdown_flag.set()
self.runner_thread.join()
self.runner_thread.join(3)

View File

@ -185,12 +185,12 @@ class SocketInterfaceHandler:
# Gracefully shutdown the server
if self.command_server:
self.command_server.shutdown()
self.command_server_thread.join()
self.command_server_thread.join(3)
del self.command_server
if self.data_server:
self.data_server.shutdown()
self.data_server_thread.join()
self.data_server_thread.join(3)
del self.data_server
self.log(f"socket interfaces stopped")