MCPcopy Index your code
hub / github.com/python/cpython / locked

Method locked

Lib/asyncio/locks.py:380–384  ·  view source on GitHub ↗

Returns True if semaphore cannot be acquired immediately.

(self)

Source from the content-addressed store, hash-verified

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.

Callers 7

__repr__Method · 0.95
acquireMethod · 0.95
test_semaphoreMethod · 0.95
test_acquireMethod · 0.95
test_acquire_hangMethod · 0.95

Calls 2

anyFunction · 0.50
cancelledMethod · 0.45

Tested by 5

test_semaphoreMethod · 0.76
test_acquireMethod · 0.76
test_acquire_hangMethod · 0.76