summaryrefslogtreecommitdiff
path: root/lib/git/async/util.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-06-11 14:59:02 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-06-11 14:59:02 +0200
commitf606937a7a21237c866efafcad33675e6539c103 (patch)
tree13ba7731de4798b2c9bfa24ccc893e4d8e5b8e8d /lib/git/async/util.py
parent257a8a9441fca9a9bc384f673ba86ef5c3f1715d (diff)
parent18e3252a1f655f09093a4cffd5125342a8f94f3b (diff)
downloadgitpython-f606937a7a21237c866efafcad33675e6539c103.tar.gz
Merge branch 'taskdep' into async
Diffstat (limited to 'lib/git/async/util.py')
-rw-r--r--lib/git/async/util.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/git/async/util.py b/lib/git/async/util.py
index 00d0dbab..11ab75a6 100644
--- a/lib/git/async/util.py
+++ b/lib/git/async/util.py
@@ -101,10 +101,12 @@ class HSCondition(deque):
waiter.acquire() # get it the first time, no blocking
self.append(waiter)
- # in the momemnt we release our lock, someone else might actually resume
- self._lock.release()
- try: # restore state no matter what (e.g., KeyboardInterrupt)
+
+ try:
+ # restore state no matter what (e.g., KeyboardInterrupt)
# now we block, as we hold the lock already
+ # in the momemnt we release our lock, someone else might actually resume
+ self._lock.release()
if timeout is None:
waiter.acquire()
else:
@@ -206,7 +208,6 @@ class AsyncQueue(deque):
return old
finally:
self.mutex.release()
-
# if we won't receive anymore items, inform the getters
if not state:
self.not_empty.notify_all()
@@ -222,6 +223,13 @@ class AsyncQueue(deque):
def put(self, item, block=True, timeout=None):
self.mutex.acquire()
+ # NOTE: we explicitly do NOT check for our writable state
+ # Its just used as a notification signal, and we need to be able
+ # to continue writing to prevent threads ( easily ) from failing
+ # to write their computed results, which we want in fact
+ # NO: we want them to fail and stop processing, as the one who caused
+ # the channel to close had a reason and wants the threads to
+ # stop on the task as soon as possible
if not self._writable:
self.mutex.release()
raise ReadOnly