improve sdr device state handling
This commit is contained in:
parent
e408c66702
commit
cb8ec3c760
@ -288,10 +288,12 @@ class SdrSource(ABC):
|
|||||||
nonlocal failed
|
nonlocal failed
|
||||||
rc = self.process.wait()
|
rc = self.process.wait()
|
||||||
logger.debug("shut down with RC={0}".format(rc))
|
logger.debug("shut down with RC={0}".format(rc))
|
||||||
|
self.process = None
|
||||||
self.monitor = None
|
self.monitor = None
|
||||||
if self.getState() is SdrSourceState.RUNNING:
|
if self.getState() is SdrSourceState.RUNNING:
|
||||||
failed = True
|
|
||||||
self.fail()
|
self.fail()
|
||||||
|
else:
|
||||||
|
failed = True
|
||||||
self.setState(SdrSourceState.STOPPED)
|
self.setState(SdrSourceState.STOPPED)
|
||||||
|
|
||||||
self.monitor = threading.Thread(target=wait_for_process_to_end, name="source_monitor")
|
self.monitor = threading.Thread(target=wait_for_process_to_end, name="source_monitor")
|
||||||
@ -341,11 +343,9 @@ class SdrSource(ABC):
|
|||||||
return self.monitor is not None
|
return self.monitor is not None
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.setState(SdrSourceState.STOPPING)
|
|
||||||
|
|
||||||
with self.modificationLock:
|
with self.modificationLock:
|
||||||
|
|
||||||
if self.process is not None:
|
if self.process is not None:
|
||||||
|
self.setState(SdrSourceState.STOPPING)
|
||||||
try:
|
try:
|
||||||
os.killpg(os.getpgid(self.process.pid), signal.SIGTERM)
|
os.killpg(os.getpgid(self.process.pid), signal.SIGTERM)
|
||||||
except ProcessLookupError:
|
except ProcessLookupError:
|
||||||
|
Loading…
Reference in New Issue
Block a user