MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / release

Method release

pymongo/_asyncio_lock.py:148–163  ·  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

146 return True
147
148 def release(self) -> None:
149 """Release a lock.
150
151 When the lock is locked, reset it to unlocked, and return.
152 If any other tasks are blocked waiting for the lock to become
153 unlocked, allow exactly one of them to proceed.
154
155 When invoked on an unlocked lock, a RuntimeError is raised.
156
157 There is no return value.
158 """
159 if self._locked:
160 self._locked = False
161 self._wake_up_first()
162 else:
163 raise RuntimeError("Lock is not acquired")
164
165 def _wake_up_first(self) -> None:
166 """Ensure that the first waiter will wake up."""

Callers 10

test_waitMethod · 0.80
c1Method · 0.80
test_wait_forMethod · 0.80
_release_locksFunction · 0.80
pool_options.pyFile · 0.80
__aexit__Method · 0.80
waitMethod · 0.80
_after_forkFunction · 0.80

Calls 1

_wake_up_firstMethod · 0.95

Tested by 5

test_waitMethod · 0.64
c1Method · 0.64
test_wait_forMethod · 0.64