Resolve dead lock issue in job_on_hold implementation
(Hopefully) closes #2677
This commit is contained in:
1 parent
386ae7609d
commit
a2527998c2
1 file changed
+8
-1
@@ -780,6 +780,9 @@ class MachineCom(object):
|
||||
return self._job_on_hold.counter > 0
|
||||
|
||||
def set_job_on_hold(self, value, blocking=True):
|
||||
trigger = False
|
||||
|
||||
# don't run any locking code beyond this...
|
||||
if not self._job_on_hold.acquire(blocking=blocking):
|
||||
return False
|
||||
|
||||
@@ -789,10 +792,14 @@ class MachineCom(object):
|
||||
else:
|
||||
self._job_on_hold.clear()
|
||||
if self._job_on_hold.counter == 0:
|
||||
self._continue_sending()
|
||||
trigger = True
|
||||
finally:
|
||||
self._job_on_hold.release()
|
||||
|
||||
# locking code is now safe to run again
|
||||
if trigger:
|
||||
self._continue_sending()
|
||||
|
||||
return True
|
||||
|
||||
def close(self, is_error=False, wait=True, timeout=10.0, *args, **kwargs):
|
||||
|
||||
Reference in new issue
Block a user