lock on dsp to avoid race conditions
This commit is contained in:
parent
0c7b0d2eaa
commit
118335b2b6
@ -140,6 +140,7 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
|
|||||||
super().__init__(conn)
|
super().__init__(conn)
|
||||||
|
|
||||||
self.dsp = None
|
self.dsp = None
|
||||||
|
self.dspLock = threading.Lock()
|
||||||
self.sdr = None
|
self.sdr = None
|
||||||
self.configSubs = []
|
self.configSubs = []
|
||||||
self.bookmarkSub = None
|
self.bookmarkSub = None
|
||||||
@ -351,15 +352,17 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
|
|||||||
super().close()
|
super().close()
|
||||||
|
|
||||||
def stopDsp(self):
|
def stopDsp(self):
|
||||||
if self.dsp is not None:
|
with self.dspLock:
|
||||||
self.dsp.stop()
|
if self.dsp is not None:
|
||||||
self.dsp = None
|
self.dsp.stop()
|
||||||
|
self.dsp = None
|
||||||
if self.sdr is not None:
|
if self.sdr is not None:
|
||||||
self.sdr.removeSpectrumClient(self)
|
self.sdr.removeSpectrumClient(self)
|
||||||
|
|
||||||
def getDsp(self):
|
def getDsp(self):
|
||||||
if self.dsp is None and self.sdr is not None:
|
with self.dspLock:
|
||||||
self.dsp = DspManager(self, self.sdr)
|
if self.dsp is None and self.sdr is not None:
|
||||||
|
self.dsp = DspManager(self, self.sdr)
|
||||||
return self.dsp
|
return self.dsp
|
||||||
|
|
||||||
def write_spectrum_data(self, data):
|
def write_spectrum_data(self, data):
|
||||||
|
Loading…
Reference in New Issue
Block a user