diff options
author | Damien George <damien@micropython.org> | 2020-11-30 17:38:30 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2020-12-02 12:07:06 +1100 |
commit | 309dfe39e07d3c3c8ba873ed09116cea9f6f52c0 (patch) | |
tree | b9546223768ef0c32ee54ff890ba4be96097f66c /extmod/uasyncio/task.py | |
parent | ca40eb0fdadd5a963b9a065999b092f029a598d5 (diff) | |
download | micropython-309dfe39e07d3c3c8ba873ed09116cea9f6f52c0.tar.gz micropython-309dfe39e07d3c3c8ba873ed09116cea9f6f52c0.zip |
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>
Diffstat (limited to 'extmod/uasyncio/task.py')
-rw-r--r-- | extmod/uasyncio/task.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/extmod/uasyncio/task.py b/extmod/uasyncio/task.py index 2420ab7193..68ddf496f0 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: |