Skip to content

Commit 6be4047

Browse files
committed
Prevent configure while processor running
Add a lifecycle lock and guard in DLCLiveProcessor.configure to ensure the processor is stopped before reconfiguration. The method now acquires self._lifecycle_lock and raises a RuntimeError if the processor state is not WorkerState.STOPPED, preventing concurrent/race-condition updates to settings or processor while running.
1 parent 5ec6266 commit 6be4047

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

dlclivegui/services/dlc_processor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ def get_model_backend(model_path: str) -> Engine:
181181
return Engine.from_model_path(model_path)
182182

183183
def configure(self, settings: DLCProcessorSettings, processor: Any | None = None) -> None:
184+
with self._lifecycle_lock:
185+
if self._state != WorkerState.STOPPED:
186+
raise RuntimeError("Cannot configure DLCLiveProcessor while it is running. Please stop it first.")
184187
self._settings = settings
185188
self._processor = processor
186189

0 commit comments

Comments
 (0)