[FIX] hw_{scanner,escpos}: ensure we always release the lock.

[FIX] hw_scanner: mark the thread as deamon.

bzr revid: chs@openerp.com-20140329144146-utr8gexna4un65u1
This commit is contained in:
Christophe Simonis 2014-03-29 15:41:46 +01:00
parent 2d0d198498
commit 37c469c5cd
2 changed files with 8 additions and 9 deletions

View File

@ -51,11 +51,10 @@ class EscposDriver(Thread):
return connected
def lockedstart(self):
self.lock.acquire()
if not self.isAlive():
self.daemon = True
self.start()
self.lock.release()
with self.lock:
if not self.isAlive():
self.daemon = True
self.start()
def get_escpos_printer(self):
try:

View File

@ -88,10 +88,10 @@ class Scanner(Thread):
}
def lockedstart(self):
self.lock.acquire()
if not self.isAlive():
self.start()
self.lock.release()
with self.lock:
if not self.isAlive():
self.daemon = True
self.start()
def set_status(self, status, message = None):
if status == self.status['status']: