mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 14:17:13 -05:00
daemonize helper threads so that sys.exit() during startup works
with daemonize set to False, the app hangs waiting on the helper threads
This commit is contained in:
parent
90dd0efed4
commit
9fb5a3257c
2 changed files with 3 additions and 0 deletions
|
|
@ -197,6 +197,7 @@ class MPVBase:
|
||||||
"""Start up the communication threads.
|
"""Start up the communication threads.
|
||||||
"""
|
"""
|
||||||
self._thread = threading.Thread(target=self._reader)
|
self._thread = threading.Thread(target=self._reader)
|
||||||
|
self._thread.daemon = True
|
||||||
self._thread.start()
|
self._thread.start()
|
||||||
|
|
||||||
def _stop_thread(self):
|
def _stop_thread(self):
|
||||||
|
|
@ -450,6 +451,7 @@ class MPV(MPVBase):
|
||||||
"""
|
"""
|
||||||
super()._start_thread()
|
super()._start_thread()
|
||||||
self._event_thread = threading.Thread(target=self._event_reader)
|
self._event_thread = threading.Thread(target=self._event_reader)
|
||||||
|
self._event_thread.daemon = True
|
||||||
self._event_thread.start()
|
self._event_thread.start()
|
||||||
|
|
||||||
def _stop_thread(self):
|
def _stop_thread(self):
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ class MediaServer(threading.Thread):
|
||||||
|
|
||||||
_port = None
|
_port = None
|
||||||
_ready = threading.Event()
|
_ready = threading.Event()
|
||||||
|
daemon = True
|
||||||
|
|
||||||
def __init__(self, mw, *args, **kwargs):
|
def __init__(self, mw, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue