Hi Guido, Hi List, for t in asyncio.Task.all_tasks(loop): > t.cancel() > loop.run_until_complete(asyncio.sleep(0.1)) # Give them a little time to > recover > loop.close() >
That solves my problem. Couln't we write def cancel(self): on top of it and put it into BaseEventLoop? In this case we should even be able to replace the run_until_complete by a mere self._run_once(), then we don't need to wait an extra 0.1. Sure, if tasks start to resist being cancelled, that's a big mess. But I do think there is quite a number of programmers out there who withstood the temptation to let tasks resist their cancellation, but who would like to have their finalizers called in an orderly fashion. Greetings Martin
