Commit c1cf1fe5 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

workerpool: Add two additional assertions


Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 2f4e1516
......@@ -108,6 +108,8 @@ class BaseWorker(threading.Thread, object):
logging.debug("Done with task %r", self._current_task)
except: # pylint: disable-msg=W0702
logging.exception("Caught unhandled exception")
assert self._HasRunningTaskUnlocked()
finally:
# Notify pool
pool._lock.acquire()
......@@ -118,6 +120,8 @@ class BaseWorker(threading.Thread, object):
finally:
pool._lock.release()
assert not self._HasRunningTaskUnlocked()
logging.debug("Terminates")
def RunTask(self, *args):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment