[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:
parent
2d0d198498
commit
37c469c5cd
|
@ -51,11 +51,10 @@ class EscposDriver(Thread):
|
||||||
return connected
|
return connected
|
||||||
|
|
||||||
def lockedstart(self):
|
def lockedstart(self):
|
||||||
self.lock.acquire()
|
with self.lock:
|
||||||
if not self.isAlive():
|
if not self.isAlive():
|
||||||
self.daemon = True
|
self.daemon = True
|
||||||
self.start()
|
self.start()
|
||||||
self.lock.release()
|
|
||||||
|
|
||||||
def get_escpos_printer(self):
|
def get_escpos_printer(self):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -88,10 +88,10 @@ class Scanner(Thread):
|
||||||
}
|
}
|
||||||
|
|
||||||
def lockedstart(self):
|
def lockedstart(self):
|
||||||
self.lock.acquire()
|
with self.lock:
|
||||||
if not self.isAlive():
|
if not self.isAlive():
|
||||||
self.start()
|
self.daemon = True
|
||||||
self.lock.release()
|
self.start()
|
||||||
|
|
||||||
def set_status(self, status, message = None):
|
def set_status(self, status, message = None):
|
||||||
if status == self.status['status']:
|
if status == self.status['status']:
|
||||||
|
|
Loading…
Reference in New Issue