MCPcopy
hub / github.com/python-trio/trio / wait

Method wait

src/trio/_sync.py:104–120  ·  view source on GitHub ↗

Block until the internal flag value becomes True. If it's already True, then this method returns immediately.

(self)

Source from the content-addressed store, hash-verified

102 self._tasks.clear()
103
104 async def wait(self) -> None:
105 """Block until the internal flag value becomes True.
106
107 If it's already True, then this method returns immediately.
108
109 """
110 if self._flag:
111 await trio.lowlevel.checkpoint()
112 else:
113 task = _core.current_task()
114 self._tasks.add(task)
115
116 def abort_fn(_: RaiseCancelT) -> Abort:
117 self._tasks.remove(task)
118 return _core.Abort.SUCCEEDED
119
120 await _core.wait_task_rescheduled(abort_fn)
121
122 def statistics(self) -> EventStatistics:
123 """Return an object containing debugging information.

Calls 1

addMethod · 0.80