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

Method release

Lib/threading.py:212–233  ·  view source on GitHub ↗

Release a lock, decrementing the recursion level. If after the decrement it is zero, reset the lock to unlocked (not owned by any thread), and if any other threads are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. If after the

(self)

Source from the content-addressed store, hash-verified

210 __enter__ = acquire
211
212 def release(self):
213 """Release a lock, decrementing the recursion level.
214
215 If after the decrement it is zero, reset the lock to unlocked (not owned
216 by any thread), and if any other threads are blocked waiting for the
217 lock to become unlocked, allow exactly one of them to proceed. If after
218 the decrement the recursion level is still nonzero, the lock remains
219 locked and owned by the calling thread.
220
221 Only call this method when the calling thread owns the lock. A
222 RuntimeError is raised if this method is called when the lock is
223 unlocked.
224
225 There is no return value.
226
227 """
228 if self._owner != get_ident():
229 raise RuntimeError("cannot release un-acquired lock")
230 self._count = count = self._count - 1
231 if not count:
232 self._owner = None
233 self._block.release()
234
235 def __exit__(self, t, v, tb):
236 self.release()

Callers 12

__exit__Method · 0.95
_release_saveMethod · 0.45
_release_saveMethod · 0.45
_is_ownedMethod · 0.45
notifyMethod · 0.45
_internal_pollMethod · 0.45
_waitMethod · 0.45
_get_candidate_namesFunction · 0.45
_gettempdirFunction · 0.45
putMethod · 0.45
checkEnvironmentFunction · 0.45
build_universal_opensslFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected