try/finally

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@45653 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
piman@chromium.org 16 years ago
parent 6f36372433
commit 09fd102397

@ -385,15 +385,17 @@ class ThreadPool:
"""Executes jobs from the pool's queue.""" """Executes jobs from the pool's queue."""
while not self._done: while not self._done:
f = self._pool._queue.get() f = self._pool._queue.get()
try:
try: try:
f(self) f(self)
except Exception, e: except Exception, e:
# Catch all exceptions, otherwise we can't join the thread. Print the # Catch all exceptions, otherwise we can't join the thread. Print
# backtrace now, but keep the exception so that we can raise it on the # the backtrace now, but keep the exception so that we can raise it
# main thread. # on the main thread.
type, value, tb = sys.exc_info() type, value, tb = sys.exc_info()
traceback.print_exception(type, value, tb) traceback.print_exception(type, value, tb)
self.exceptions.append(e) self.exceptions.append(e)
finally:
self._pool._JobDone() self._pool._JobDone()
def _AddJobToQueue(self, job): def _AddJobToQueue(self, job):

Loading…
Cancel
Save