Put a token back into the sack on behalf of ``borrower``. Raises: RuntimeError: if the given borrower has not acquired one of this sack's tokens.
(self, borrower: Task | object)
| 396 | |
| 397 | @enable_ki_protection |
| 398 | def release_on_behalf_of(self, borrower: Task | object) -> None: |
| 399 | """Put a token back into the sack on behalf of ``borrower``. |
| 400 | |
| 401 | Raises: |
| 402 | RuntimeError: if the given borrower has not acquired one of this |
| 403 | sack's tokens. |
| 404 | |
| 405 | """ |
| 406 | if borrower not in self._borrowers: |
| 407 | raise RuntimeError( |
| 408 | "this borrower isn't holding any of this CapacityLimiter's tokens", |
| 409 | ) |
| 410 | self._borrowers.remove(borrower) |
| 411 | self._wake_waiters() |
| 412 | |
| 413 | def statistics(self) -> CapacityLimiterStatistics: |
| 414 | """Return an object containing debugging information. |