From a85399c62c1050bdb32e4a55bdc3f0c2bde1dd19 Mon Sep 17 00:00:00 2001 From: Gabriel David Pragin Date: Thu, 22 Jan 2026 18:08:08 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20make=20internal=20threads?= =?UTF-8?q?=20daemon=20to=20prevent=20shutdown=20hang?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When MPV is killed externally, non-daemon threads block on I/O operations and Python's interpreter shutdown waits for them indefinitely. Setting daemon=True allows Python to exit cleanly without waiting for these threads. --- python_mpv_jsonipc.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python_mpv_jsonipc.py b/python_mpv_jsonipc.py index 1d89d50..bed3393 100644 --- a/python_mpv_jsonipc.py +++ b/python_mpv_jsonipc.py @@ -72,6 +72,7 @@ def __init__(self, ipc_socket, callback=None, quit_callback=None): self.callback = lambda data: None threading.Thread.__init__(self) + self.daemon = True def stop(self, join=True): """Terminate the thread.""" @@ -144,6 +145,7 @@ def __init__(self, ipc_socket, callback=None, quit_callback=None): self.callback = lambda data: None threading.Thread.__init__(self) + self.daemon = True def stop(self, join=True): """Terminate the thread.""" @@ -356,6 +358,7 @@ def __init__(self): """Create an instance of the thread.""" self.queue = queue.Queue() threading.Thread.__init__(self) + self.daemon = True def put_task(self, func, *args): """