From 09fd1023977b55f7a65da066c39500c49d130107 Mon Sep 17 00:00:00 2001 From: "piman@chromium.org" Date: Tue, 27 Apr 2010 00:41:12 +0000 Subject: [PATCH] try/finally git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@45653 0039d316-1c4b-4281-b951-d872f2087c98 --- gclient_utils.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/gclient_utils.py b/gclient_utils.py index 4f8b5786df..d2470dfb88 100644 --- a/gclient_utils.py +++ b/gclient_utils.py @@ -386,15 +386,17 @@ class ThreadPool: while not self._done: f = self._pool._queue.get() try: - f(self) - except Exception, e: - # Catch all exceptions, otherwise we can't join the thread. Print the - # backtrace now, but keep the exception so that we can raise it on the - # main thread. - type, value, tb = sys.exc_info() - traceback.print_exception(type, value, tb) - self.exceptions.append(e) - self._pool._JobDone() + try: + f(self) + except Exception, e: + # Catch all exceptions, otherwise we can't join the thread. Print + # the backtrace now, but keep the exception so that we can raise it + # on the main thread. + type, value, tb = sys.exc_info() + traceback.print_exception(type, value, tb) + self.exceptions.append(e) + finally: + self._pool._JobDone() def _AddJobToQueue(self, job): self._condition.acquire()