summaryrefslogtreecommitdiff
path: root/lib/git
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-06-11 11:52:01 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-06-11 11:52:01 +0200
commit6d1212e8c412b0b4802bc1080d38d54907db879d (patch)
tree09025a39d44fa2a28a6533a0f969316652f974bc /lib/git
parentfbe062bf6dacd3ad63dd827d898337fa542931ac (diff)
downloadgitpython-6d1212e8c412b0b4802bc1080d38d54907db879d.tar.gz
IMPORTANT: sometimes, when notifying waiters by releasing their lock, the lock is not actually released or they are not actually notifyied, staying in a beautysleep. This glitch is probably caused by some detail not treated correctly in the thread python module, which is something we cannot fix. It works most of the time as expected though - maybe some cleanup is not done correctly which causes this
Diffstat (limited to 'lib/git')
-rw-r--r--lib/git/async/pool.py1
-rw-r--r--lib/git/async/thread.py2
-rw-r--r--lib/git/async/util.py8
3 files changed, 5 insertions, 6 deletions
diff --git a/lib/git/async/pool.py b/lib/git/async/pool.py
index 0aad90ae..dbc201a9 100644
--- a/lib/git/async/pool.py
+++ b/lib/git/async/pool.py
@@ -324,7 +324,6 @@ class Pool(object):
threadsafe to optimize item throughput.
:note: currently NOT threadsafe !"""
- print "set_size", size
assert size > -1, "Size cannot be negative"
# either start new threads, or kill existing ones.
diff --git a/lib/git/async/thread.py b/lib/git/async/thread.py
index b8d2e418..4d046a2f 100644
--- a/lib/git/async/thread.py
+++ b/lib/git/async/thread.py
@@ -146,9 +146,7 @@ class WorkerThread(TerminatableThread):
# we wait and block - to terminate, send the 'stop' method
tasktuple = gettask()
-
# needing exactly one function, and one arg
- assert len(tasktuple) == 2, "Need tuple of function, arg - it could be more flexible, but its reduced to what we need"
routine, arg = tasktuple
try:
diff --git a/lib/git/async/util.py b/lib/git/async/util.py
index b7750b0b..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: