Decrement the semaphore value, blocking if necessary to avoid letting it drop below zero.
(self)
| 516 | |
| 517 | @enable_ki_protection |
| 518 | async def acquire(self) -> None: |
| 519 | """Decrement the semaphore value, blocking if necessary to avoid |
| 520 | letting it drop below zero. |
| 521 | |
| 522 | """ |
| 523 | await trio.lowlevel.checkpoint_if_cancelled() |
| 524 | try: |
| 525 | self.acquire_nowait() |
| 526 | except trio.WouldBlock: |
| 527 | await self._lot.park() |
| 528 | else: |
| 529 | await trio.lowlevel.cancel_shielded_checkpoint() |
| 530 | |
| 531 | @enable_ki_protection |
| 532 | def release(self) -> None: |