MCPcopy
hub / github.com/python-trio/trio / acquire_nowait

Method acquire_nowait

src/trio/_sync.py:307–316  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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:

Callers 3

test_CapacityLimiterFunction · 0.95
test_CapacityLimiter_infFunction · 0.95

Calls 1

Tested by 3

test_CapacityLimiterFunction · 0.76
test_CapacityLimiter_infFunction · 0.76