Borrow a token from the sack, without blocking. Raises: WouldBlock: if no tokens are available. RuntimeError: if the current task already holds one of this sack's tokens.
(self)
| 305 | |
| 306 | @enable_ki_protection |
| 307 | def acquire_nowait(self) -> None: |
| 308 | """Borrow a token from the sack, without blocking. |
| 309 | |
| 310 | Raises: |
| 311 | WouldBlock: if no tokens are available. |
| 312 | RuntimeError: if the current task already holds one of this sack's |
| 313 | tokens. |
| 314 | |
| 315 | """ |
| 316 | self.acquire_on_behalf_of_nowait(trio.lowlevel.current_task()) |
| 317 | |
| 318 | @enable_ki_protection |
| 319 | def acquire_on_behalf_of_nowait(self, borrower: Task | object) -> None: |