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)
| 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 | |
| 219 | class Condition(_ContextManagerMixin, mixins._LoopBoundMixin): |