From c1cf1fe51176fa71a7ef217ad8042c007000df66 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Sat, 17 Jul 2010 23:00:56 +0200 Subject: [PATCH] workerpool: Add two additional assertions Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/workerpool.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/workerpool.py b/lib/workerpool.py index e09f47329..e1985beab 100644 --- a/lib/workerpool.py +++ b/lib/workerpool.py @@ -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): -- GitLab