Commit eb611169 authored by Denis Bilenko's avatar Denis Bilenko

avoid unnecessary event scheduling in Semaphore

parent f5e5de69
......@@ -67,7 +67,7 @@ class Semaphore(object):
def release(self, blocking=True):
# `blocking' parameter is for consistency with BoundedSemaphore and is ignored
self.counter += 1
if self._waiters:
if self._waiters and self.counter > 0:
active_event(self._do_acquire)
return True
......
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