From b3cde0ee162b8f0cb67da981311c8f9c16050a62 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 6 Jun 2010 18:13:21 +0200 Subject: First step of testing the pool - tasks have been separated into a new module including own tests, their design improved to prepare them for some specifics that would be needed for multiprocessing support --- lib/git/async/thread.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/git/async/thread.py') diff --git a/lib/git/async/thread.py b/lib/git/async/thread.py index 7ca93c86..82acbd8f 100644 --- a/lib/git/async/thread.py +++ b/lib/git/async/thread.py @@ -139,10 +139,15 @@ class WorkerThread(TerminatableThread): if self._should_terminate(): break # END check for stop request - routine = self.__class__.quit + routine = None args = tuple() kwargs = dict() - tasktuple = self.inq.get() + # don't wait too long, instead check for the termination request more often + try: + tasktuple = self.inq.get(True, 1) + except Queue.Empty: + continue + # END get task with timeout if isinstance(tasktuple, (tuple, list)): if len(tasktuple) == 3: -- cgit v1.2.1