Returns True if semaphore cannot be acquired immediately.
(self)
| 378 | return f'<{res[1:-1]} [{extra}]>' |
| 379 | |
| 380 | def locked(self): |
| 381 | """Returns True if semaphore cannot be acquired immediately.""" |
| 382 | # Due to state, or FIFO rules (must allow others to run first). |
| 383 | return self._value == 0 or ( |
| 384 | any(not w.cancelled() for w in (self._waiters or ()))) |
| 385 | |
| 386 | async def acquire(self): |
| 387 | """Acquire a semaphore. |