Merge pull request #430 from anskornyakov/hotfix/semaphore-deadlock
fix deadlock in nonblocking semaphore acquiring
This commit is contained in:
commit
3cc86ac06e
@ -557,10 +557,10 @@ class Semaphore(object):
|
||||
w = _Watch(duration=timeout)
|
||||
w.start()
|
||||
lock = self.client.Lock(self.lock_path, self.data)
|
||||
gotten = lock.acquire(blocking=blocking, timeout=w.leftover())
|
||||
if not gotten:
|
||||
return False
|
||||
try:
|
||||
gotten = lock.acquire(blocking=blocking, timeout=w.leftover())
|
||||
if not gotten:
|
||||
return False
|
||||
while True:
|
||||
self.wake_event.clear()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user