| f | import asyncio | f | import asyncio |
| | | |
| class Portal(asyncio.Barrier): | | class Portal(asyncio.Barrier): |
| | | |
| n | def __init__(self, count): | n | def __init__(self, parties): |
| super().__init__(count) | | super().__init__(parties) |
| self._topic = None | | self._topic = None |
| | | |
| @property | | @property |
| def topic(self): | | def topic(self): |
| return self._topic | | return self._topic |
| | | |
| t | async def wait(self, data=None): | t | async def wait(self, topic=None): |
| if data is not None: | | if topic is not None: |
| self._topic = data | | self._topic = topic |
| return await super().wait() | | return await super().wait() |
| | | |
| async def reset(self): | | async def reset(self): |
| self._topic = None | | self._topic = None |
| await super().reset() | | await super().reset() |
| | | |
| async def abort(self): | | async def abort(self): |
| self._topic = None | | self._topic = None |
| await super().abort() | | await super().abort() |