summaryrefslogtreecommitdiff
path: root/lib/git/async/thread.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-06-09 11:28:37 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-06-09 11:28:37 +0200
commitf2c8d26d3b25b864ad48e6de018757266b59f708 (patch)
tree4c455469b09e049ff8e29e6166bc2118356dc9cd /lib/git/async/thread.py
parent15941ca090a2c3c987324fc911bbc6f89e941c47 (diff)
downloadgitpython-f2c8d26d3b25b864ad48e6de018757266b59f708.tar.gz
thread: fixed initialization problem if an empty iterable was handed in
queue: Queue now derives from deque directly, which safes one dict lookup as the queue does not need to be accessed through self anymore pool test improved to better verify threads are started correctly
Diffstat (limited to 'lib/git/async/thread.py')
-rw-r--r--lib/git/async/thread.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/git/async/thread.py b/lib/git/async/thread.py
index cd964f1c..faeda04f 100644
--- a/lib/git/async/thread.py
+++ b/lib/git/async/thread.py
@@ -125,7 +125,9 @@ class WorkerThread(TerminatableThread):
def __init__(self, inq = None):
super(WorkerThread, self).__init__()
- self.inq = inq or Queue.Queue()
+ self.inq = inq
+ if inq is None:
+ self.inq = Queue.Queue()
self._current_routine = None # routine we execute right now
@classmethod
@@ -135,6 +137,8 @@ class WorkerThread(TerminatableThread):
def run(self):
"""Process input tasks until we receive the quit signal"""
+ print self.name, "starts processing" # DEBUG
+
gettask = self.inq.get
while True:
self._current_routine = None
@@ -166,7 +170,7 @@ class WorkerThread(TerminatableThread):
break
# END make routine call
except StopProcessing:
- print self.name, "stops processing"
+ print self.name, "stops processing" # DEBUG
break
except Exception,e:
print >> sys.stderr, "%s: Task %s raised unhandled exception: %s - this really shouldn't happen !" % (self.getName(), str(tasktuple), str(e))