Commit 200a63c1 authored by Julien Muchembled's avatar Julien Muchembled

Make verbose locks work in 'with' statements

parent d9471e2e
...@@ -100,11 +100,16 @@ class VerboseLockBase(object): ...@@ -100,11 +100,16 @@ class VerboseLockBase(object):
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)
__enter__ = acquire
def release(self): def release(self):
me = LockUser() me = LockUser()
self._note('[%r]%s.release() Waiting: %r', me, self, self.waiting) self._note('[%r]%s.release() Waiting: %r', me, self, self.waiting)
return self.lock.release() return self.lock.release()
def __exit__(self, t, v, tb):
self.release()
def _locked(self): def _locked(self):
raise NotImplementedError raise NotImplementedError
......
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