Skip to content

Commit

Permalink
Async CABI: tweak canon_task_poll text to match changes to Task.poll
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewagner committed Oct 9, 2024
1 parent 485ea19 commit 2323ed5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions design/mvp/CanonicalABI.md
Original file line number Diff line number Diff line change
Expand Up @@ -2385,13 +2385,14 @@ if there was an event, storing the `i32` event+payload pair as an outparam.
```python
async def canon_task_poll(task, ptr):
trap_if(not task.inst.may_leave)
ret = task.poll()
ret = await task.poll()
if ret is None:
return [0]
store(task, ret, TupleType([U32Type(), U32Type()]), ptr)
return [1]
```
Note that there is no `await` of `poll` and thus no possible task switching.
Note that the `await` of `task.poll` indicates that `task.poll` can yield to
other tasks (in this or other components) as part of polling for an event.

### 🔀 `canon task.yield`

Expand Down
2 changes: 1 addition & 1 deletion design/mvp/canonical-abi/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ async def canon_task_wait(task, ptr):

async def canon_task_poll(task, ptr):
trap_if(not task.inst.may_leave)
ret = task.poll()
ret = await task.poll()
if ret is None:
return [0]
store(task, ret, TupleType([U32Type(), U32Type()]), ptr)
Expand Down

0 comments on commit 2323ed5

Please sign in to comment.