(self)
| 370 | self.wakeup.release() |
| 371 | |
| 372 | def release(self): |
| 373 | tid = _thread.get_ident() |
| 374 | with self.lock: |
| 375 | if self.owner != tid: |
| 376 | raise RuntimeError('cannot release un-acquired lock') |
| 377 | assert len(self.count) > 0 |
| 378 | self.count.pop() |
| 379 | if not len(self.count): |
| 380 | self.owner = None |
| 381 | if len(self.waiters) > 0: |
| 382 | self.waiters.pop() |
| 383 | self.wakeup.release() |
| 384 | |
| 385 | def locked(self): |
| 386 | return bool(self.count) |
no test coverage detected