synchronize scheduler access
This commit is contained in:
parent
3814767e28
commit
6f983ccb6b
@ -90,6 +90,7 @@ class WsjtChopper(threading.Thread):
|
||||
(self.wavefilename, self.wavefile) = self.getWaveFile()
|
||||
self.switchingLock = threading.Lock()
|
||||
self.scheduler = sched.scheduler(time.time, time.sleep)
|
||||
self.schedulerLock = threading.Lock()
|
||||
(self.outputReader, self.outputWriter) = Pipe()
|
||||
self.doRun = True
|
||||
super().__init__()
|
||||
@ -118,10 +119,12 @@ class WsjtChopper(threading.Thread):
|
||||
threading.Thread(target=self.scheduler.run).start()
|
||||
|
||||
def emptyScheduler(self):
|
||||
with self.schedulerLock:
|
||||
for event in self.scheduler.queue:
|
||||
self.scheduler.cancel(event)
|
||||
|
||||
def _scheduleNextSwitch(self):
|
||||
with self.schedulerLock:
|
||||
self.scheduler.enterabs(self.getNextDecodingTime(), 1, self.switchFiles)
|
||||
|
||||
def switchFiles(self):
|
||||
|
Loading…
Reference in New Issue
Block a user