MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / notify

Method notify

tools/python-3.11.9-amd64/Lib/asyncio/locks.py:298–320  ·  view source on GitHub ↗

By default, wake up one coroutine waiting on this condition, if any. If the calling coroutine has not acquired the lock when this method is called, a RuntimeError is raised. This method wakes up at most n of the coroutines waiting for the condition variable; it

(self, n=1)

Source from the content-addressed store, hash-verified

296 return result
297
298 def notify(self, n=1):
299 """By default, wake up one coroutine waiting on this condition, if any.
300 If the calling coroutine has not acquired the lock when this method
301 is called, a RuntimeError is raised.
302
303 This method wakes up at most n of the coroutines waiting for the
304 condition variable; it is a no-op if no coroutines are waiting.
305
306 Note: an awakened coroutine does not actually return from its
307 wait() call until it can reacquire the lock. Since notify() does
308 not release the lock, its caller should.
309 """
310 if not self.locked():
311 raise RuntimeError('cannot notify on un-acquired lock')
312
313 idx = 0
314 for fut in self._waiters:
315 if idx >= n:
316 break
317
318 if not fut.done():
319 idx += 1
320 fut.set_result(False)
321
322 def notify_all(self):
323 """Wake up all threads waiting on this condition. This method acts

Callers 3

notify_allMethod · 0.95
pollresponseMethod · 0.45
handle_EOFMethod · 0.45

Calls 3

lockedMethod · 0.45
doneMethod · 0.45
set_resultMethod · 0.45

Tested by

no test coverage detected