Moved wait outside lock and now returns false on failure.

This commit is contained in:
Marc-Andre Ferland 2022-10-28 22:52:00 -04:00
parent fc2a6567da
commit 86da27a7a1

View File

@ -375,14 +375,16 @@ def start_render_thread(device='auto'):
rthread.daemon = True rthread.daemon = True
rthread.name = THREAD_NAME_PREFIX + device rthread.name = THREAD_NAME_PREFIX + device
rthread.start() rthread.start()
timeout = DEVICE_START_TIMEOUT
while not rthread.is_alive() or not rthread in weak_thread_data or not 'device' in weak_thread_data[rthread]:
if timeout <= 0: raise Exception('render_thread', rthread.name, 'failed to start before timeout or has crashed.')
timeout -= 1
time.sleep(1)
render_threads.append(rthread) render_threads.append(rthread)
finally: finally:
manager_lock.release() manager_lock.release()
timeout = DEVICE_START_TIMEOUT
while not rthread.is_alive() or not rthread in weak_thread_data or not 'device' in weak_thread_data[rthread]:
if timeout <= 0:
return False
timeout -= 1
time.sleep(1)
return True
def shutdown_event(): # Signal render thread to close on shutdown def shutdown_event(): # Signal render thread to close on shutdown
global current_state_error global current_state_error