add assert to verify no need for mutex

This commit is contained in:
Eric House 2018-05-31 21:20:42 -07:00
parent dff130d6c6
commit b24d60e7bf

View file

@ -185,6 +185,7 @@ class Device():
self.nTilesLeftTray = None
self.relayID = None
self.relaySeed = 0
self.locked = False
with open(self.logPath, "w") as log:
log.write('New cmdline: ' + self.app + ' ' + (' '.join([str(p) for p in self.params])))
@ -200,6 +201,8 @@ class Device():
nLines += 1
log.write(line + os.linesep)
self.locked = True
# check for connname
if not self.connname:
match = Device.sConnNamePat.match(line)
@ -228,6 +231,8 @@ class Device():
self.relaySeed = int(match.group(1))
self.relayID = match.group(2)
self.locked = False
# print('logReaderMain done, wrote lines:', nLines, 'to', self.logPath);
def launch(self):
@ -293,6 +298,7 @@ class Device():
print('got exception sending to', url, params, '; is relay.py running as apache module?')
def getTilesCount(self):
assert not self.locked
return {'index': self.indx,
'nTilesLeftPool': self.nTilesLeftPool,
'nTilesLeftTray': self.nTilesLeftTray,