(device)
| 415 | |
| 416 | |
| 417 | def start_render_thread(device): |
| 418 | if not manager_lock.acquire(blocking=True, timeout=LOCK_TIMEOUT): |
| 419 | raise Exception("start_render_thread" + ERR_LOCK_FAILED) |
| 420 | log.info(f"Start new Rendering Thread on device: {device}") |
| 421 | try: |
| 422 | rthread = threading.Thread(target=thread_render, kwargs={"device": device}) |
| 423 | rthread.daemon = True |
| 424 | rthread.name = THREAD_NAME_PREFIX + device |
| 425 | rthread.start() |
| 426 | render_threads.append(rthread) |
| 427 | finally: |
| 428 | manager_lock.release() |
| 429 | timeout = DEVICE_START_TIMEOUT |
| 430 | while not rthread.is_alive() or not rthread in weak_thread_data or not "device" in weak_thread_data[rthread]: |
| 431 | if rthread in weak_thread_data and "error" in weak_thread_data[rthread]: |
| 432 | log.error(f"{rthread}, {device}, error: {weak_thread_data[rthread]['error']}") |
| 433 | return False |
| 434 | if timeout <= 0: |
| 435 | return False |
| 436 | timeout -= 1 |
| 437 | time.sleep(1) |
| 438 | return True |
| 439 | |
| 440 | |
| 441 | def stop_render_thread(device): |
no test coverage detected