use better locking for the service startup/shutdown

This commit is contained in:
Jakob Ketterl 2020-07-30 21:35:31 +02:00
parent c8e5b4f822
commit 7ea8c8f7c6

View File

@ -61,7 +61,7 @@ class Js8ServiceOutput(ServiceOutput):
class ServiceHandler(object):
def __init__(self, source):
self.lock = threading.Lock()
self.lock = threading.RLock()
self.services = []
self.source = source
self.startupTimer = None
@ -124,6 +124,7 @@ class ServiceHandler(object):
self.startupTimer.start()
def updateServices(self):
with self.lock:
logger.debug("re-scheduling services due to sdr changes")
self.stopServices()
if not self.source.isAvailable():
@ -146,9 +147,6 @@ class ServiceHandler(object):
logger.debug("no services available")
return
with self.lock:
self.services = []
groups = self.optimizeResampling(dials, sr)
if groups is None:
for dial in dials: