fixed logic error in state machine

This commit is contained in:
Nathan Fritz 2010-10-20 16:57:47 -07:00
parent 6e34b2cfdd
commit 11a6e6d2e0

View file

@ -84,7 +84,12 @@ class StateMachine(object):
start = time.time()
while not self.__current_state in from_states or not self.lock.acquire(False):
while not self.lock.acquire(False):
time.sleep(.001)
if (start + wait - time.time()) <= 0.0:
return False
while not self.__current_state in from_states:
# detect timeout:
remainder = start + wait - time.time()
if remainder > 0: self.notifier.wait(remainder)