mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 20:50:14 +01:00
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 <damien@micropython.org>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user