MCPcopy
hub / github.com/tornadoweb/tornado / release

Method release

tornado/locks.py:397–412  ·  view source on GitHub ↗

Increment the counter and wake one waiter.

(self)

Source from the content-addressed store, hash-verified

395 return f"<{res[1:-1]} [{extra}]>"
396
397 def release(self) -> None:
398 """Increment the counter and wake one waiter."""
399 self._value += 1
400 while self._waiters:
401 waiter = self._waiters.popleft()
402 if not waiter.done():
403 self._value -= 1
404
405 # If the waiter is a coroutine paused at
406 #
407 # with (yield semaphore.acquire()):
408 #
409 # then the context manager's __exit__ calls release() at the end
410 # of the "with" block.
411 waiter.set_result(_ReleasingContextManager(self))
412 break
413
414 def acquire(
415 self, timeout: Optional[Union[float, datetime.timedelta]] = None

Callers 5

__aexit__Method · 0.95
test_acquireMethod · 0.95
test_acquire_timeoutMethod · 0.95

Calls 2

doneMethod · 0.45

Tested by 4

test_acquireMethod · 0.76
test_acquire_timeoutMethod · 0.76