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

Method wait

Lib/asyncio/locks.py:200–216  ·  view source on GitHub ↗

Block until the internal flag is true. If the internal flag is true on entry, return True immediately. Otherwise, block until another task calls set() to set the flag to true, then return True.

(self)

Source from the content-addressed store, hash-verified

198 self._value = False
199
200 async def wait(self):
201 """Block until the internal flag is true.
202
203 If the internal flag is true on entry, return True
204 immediately. Otherwise, block until another task calls
205 set() to set the flag to true, then return True.
206 """
207 if self._value:
208 return True
209
210 fut = self._get_loop().create_future()
211 self._waiters.append(fut)
212 try:
213 await fut
214 return True
215 finally:
216 self._waiters.remove(fut)
217
218
219class Condition(_ContextManagerMixin, mixins._LoopBoundMixin):

Calls 4

_get_loopMethod · 0.80
create_futureMethod · 0.45
appendMethod · 0.45
removeMethod · 0.45