From 1cdbf483b87f8a47209b9ea6dc33ecaa71da902b Mon Sep 17 00:00:00 2001 From: Eskild Schroll-Fleischer Date: Sun, 21 Jan 2024 16:53:47 +0100 Subject: [PATCH] Configure ThreadLoop to be daemon Configuring a sync Client object and connecting it to an OPC-UA host will cause the calling script to hang on exit if disconnect() is not called. By setting the ThreadLoop to be a daemon resolves this issue. --- asyncua/sync.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asyncua/sync.py b/asyncua/sync.py index 546ee328d..aac6e1b24 100644 --- a/asyncua/sync.py +++ b/asyncua/sync.py @@ -34,7 +34,7 @@ class ThreadLoopNotRunning(Exception): class ThreadLoop(Thread): def __init__(self, timeout: Optional[float] = 120) -> None: - Thread.__init__(self) + Thread.__init__(self, daemon=True) self.loop = None self._cond = Condition() self.timeout = timeout