@@ -519,7 +519,6 @@ class QemuRunner:
except Exception as e:
self.logger.warning('Extra log data exception %s' % repr(e))
data = None
- self.thread.serial_lock.release()
return False
with self.thread.serial_lock:
@@ -822,10 +821,12 @@ class LoggingThread(threading.Thread):
self.logfunc(data, ".stdout")
elif self.serialsock and self.serialsock.fileno() == fd:
if self.serial_lock.acquire(blocking=False):
- data = self.recv(1024, self.serialsock)
- self.logger.debug("Data received serial thread %s" % data.decode('utf-8', 'replace'))
- self.logfunc(data, ".2")
- self.serial_lock.release()
+ try:
+ data = self.recv(1024, self.serialsock)
+ self.logger.debug("Data received serial thread %s" % data.decode('utf-8', 'replace'))
+ self.logfunc(data, ".2")
+ finally:
+ self.serial_lock.release()
else:
serial_registered = False
poll.unregister(self.serialsock.fileno())