task group: set done if empty

This commit is contained in:
Victor Shyba 2019-12-11 18:15:59 -03:00 committed by Lex Berezhny
parent fddb0c9e66
commit 1cdb4bc9e7

View file

@ -23,3 +23,5 @@ class TaskGroup:
def cancel(self): def cancel(self):
for task in self._tasks: for task in self._tasks:
task.cancel() task.cancel()
if len(self._tasks) < 1:
self.done.set()