Commits

Denis Bilenko committed 74895f7

avoid unnecessary event scheduling in Semaphore

  • Participants
  • Parent commits 2d159b8
  • Tags 0.12.1

Comments (0)

Files changed (1)

     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