Block until the signal is next dispatched. Return the context of the signal dispatch, if any.
(self)
| 100 | future: asyncio.Future | None = None |
| 101 | |
| 102 | async def wait(self): |
| 103 | """Block until the signal is next dispatched. |
| 104 | |
| 105 | Return the context of the signal dispatch, if any. |
| 106 | """ |
| 107 | loop = asyncio.get_running_loop() |
| 108 | self.future = loop.create_future() |
| 109 | self.signal.ctx.waiters.append(self) |
| 110 | try: |
| 111 | return await self.future |
| 112 | finally: |
| 113 | self.signal.ctx.waiters.remove(self) |
| 114 | |
| 115 | def matches(self, event, condition): |
| 116 | return ( |