Release a lock. When the lock is locked, reset it to unlocked, and return. If any other coroutines are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. When invoked on an unlocked lock, a RuntimeError is raised.
(self)
| 123 | return True |
| 124 | |
| 125 | def release(self): |
| 126 | """Release a lock. |
| 127 | |
| 128 | When the lock is locked, reset it to unlocked, and return. |
| 129 | If any other coroutines are blocked waiting for the lock to become |
| 130 | unlocked, allow exactly one of them to proceed. |
| 131 | |
| 132 | When invoked on an unlocked lock, a RuntimeError is raised. |
| 133 | |
| 134 | There is no return value. |
| 135 | """ |
| 136 | if self._locked: |
| 137 | self._locked = False |
| 138 | self._wake_up_first() |
| 139 | else: |
| 140 | raise RuntimeError('Lock is not acquired.') |
| 141 | |
| 142 | def _wake_up_first(self): |
| 143 | """Wake up the first waiter if it isn't done.""" |
no test coverage detected