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

Method release

Lib/asyncio/locks.py:127–142  ·  view source on GitHub ↗

Release a lock. When the lock is locked, reset it to unlocked, and return. If any other tasks are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. When invoked on an unlocked lock, a RuntimeError is raised. There is no

(self)

Source from the content-addressed store, hash-verified

125 return True
126
127 def release(self):
128 """Release a lock.
129
130 When the lock is locked, reset it to unlocked, and return.
131 If any other tasks are blocked waiting for the lock to become
132 unlocked, allow exactly one of them to proceed.
133
134 When invoked on an unlocked lock, a RuntimeError is raised.
135
136 There is no return value.
137 """
138 if self._locked:
139 self._locked = False
140 self._wake_up_first()
141 else:
142 raise RuntimeError('Lock is not acquired.')
143
144 def _wake_up_first(self):
145 """Ensure that the first waiter will wake up."""

Callers 15

test_repr_lockMethod · 0.95
test_lockMethod · 0.95
test_acquireMethod · 0.95
test_acquireMethod · 0.95
__aexit__Method · 0.45
waitMethod · 0.45
releaseMethod · 0.45
add_cookie_headerMethod · 0.45
set_cookie_if_okMethod · 0.45
set_cookieMethod · 0.45

Calls 1

_wake_up_firstMethod · 0.95

Tested by 6

test_repr_lockMethod · 0.76
test_lockMethod · 0.76
test_acquireMethod · 0.76
test_acquireMethod · 0.76