Commit ede173f8 authored by Julien Muchembled's avatar Julien Muchembled

Fix verbose locks when acquiring without blocking

parent 52ed5aab
...@@ -90,14 +90,18 @@ class VerboseLockBase(object): ...@@ -90,14 +90,18 @@ class VerboseLockBase(object):
me, self, blocking, owner) me, self, blocking, owner)
self._note('Owner traceback:\n%s', owner.formatStack()) self._note('Owner traceback:\n%s', owner.formatStack())
self._note('My traceback:\n%s', me.formatStack()) self._note('My traceback:\n%s', me.formatStack())
self.waiting.append(me) if blocking:
self.waiting.append(me)
try: try:
return self.lock.acquire(blocking) locked = self.lock.acquire(blocking)
finally: finally:
if blocking:
self.waiting.remove(me)
if locked:
self.owner = me self.owner = me
self.waiting.remove(me)
self._note('[%r]%s.acquire(%s) Lock granted. Waiting: %r', self._note('[%r]%s.acquire(%s) Lock granted. Waiting: %r',
me, self, blocking, self.waiting) me, self, blocking, self.waiting)
return locked
__enter__ = acquire __enter__ = acquire
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment