Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def cancel_all(cls, group=0, nowait=False):
tokill = cls._get_task_nos(group)
barrier = Barrier(len(tokill) + 1) # Include this task
for task_no in tokill:
cls.tasks[task_no][2] = barrier
cls._cancel(task_no)
if nowait:
barrier.trigger()
else:
await barrier