Release a semaphore, incrementing the internal counter by one or more. When the counter is zero on entry and another thread is waiting for it to become larger than zero again, wake up that thread.
(self, n=1)
| 520 | __enter__ = acquire |
| 521 | |
| 522 | def release(self, n=1): |
| 523 | """Release a semaphore, incrementing the internal counter by one or more. |
| 524 | |
| 525 | When the counter is zero on entry and another thread is waiting for it |
| 526 | to become larger than zero again, wake up that thread. |
| 527 | |
| 528 | """ |
| 529 | if n < 1: |
| 530 | raise ValueError('n must be one or more') |
| 531 | with self._cond: |
| 532 | self._value += n |
| 533 | self._cond.notify(n) |
| 534 | |
| 535 | def __exit__(self, t, v, tb): |
| 536 | self.release() |