From 309dfe39e07d3c3c8ba873ed09116cea9f6f52c0 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 30 Nov 2020 17:38:30 +1100 Subject: extmod/uasyncio: Add Task.done() method. This is added because task.coro==None is no longer the way to detect if a task is finished. Providing a (CPython compatible) function for this allows the implementation to be abstracted away. Signed-off-by: Damien George --- extmod/uasyncio/task.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'extmod/uasyncio/task.py') diff --git a/extmod/uasyncio/task.py b/extmod/uasyncio/task.py index 2420ab719..68ddf496f 100644 --- a/extmod/uasyncio/task.py +++ b/extmod/uasyncio/task.py @@ -148,6 +148,9 @@ class Task: # Set calling task's data to this task that it waits on, to double-link it. core.cur_task.data = self + def done(self): + return self.coro is self + def cancel(self): # Check if task is already finished. if self.coro is self: -- cgit v1.2.3