I've talked about this with @lukewagner @dicej and others but I realized we don't have an issue on this, so I wanted to open one. Namely the current thinking is that while the explainer as-is has no recourse for subtask cancellation and we thought we might be able to defer this to post 0.3.0 we now agree that this needs to be implemented pre-0.3.0. This issue is intended to track this.
From a spec perspective we need to write down the various interactions and such with respect to cancellation of subtasks. I've sketched out some ideas in bytecodealliance/wit-bindgen#1264 to get a feel for what this might look like in the guest bindings. My current thinking is along the lines of:
- A new
subtask.cancel canon builtin with signature [i32] -> [i32]
- Takes a subtask id as an argument
- Returns a task status code as a result
- Two new states for a subtask to be in:
STATUS_{STARTED,RETURNED}_CANCELLED
- Indicates a subtask has been succesfully cancelled
STATUS_STARTED_CANCELLED means that cancellation happened before the parameters were received, e.g. the STARTED state was never reached.
STATUS_RETURNED_CANCELLED means that cancellation happened after the parameters were received, e.g. the RETURNED state was never reached.
- A new
EventCode.CANCELLED is added
- Unsure if a new callback return code is needed?
I suspect I'm missing a lot of details here still as well.
I've talked about this with @lukewagner @dicej and others but I realized we don't have an issue on this, so I wanted to open one. Namely the current thinking is that while the explainer as-is has no recourse for subtask cancellation and we thought we might be able to defer this to post 0.3.0 we now agree that this needs to be implemented pre-0.3.0. This issue is intended to track this.
From a spec perspective we need to write down the various interactions and such with respect to cancellation of subtasks. I've sketched out some ideas in bytecodealliance/wit-bindgen#1264 to get a feel for what this might look like in the guest bindings. My current thinking is along the lines of:
subtask.cancelcanon builtin with signature[i32] -> [i32]STATUS_{STARTED,RETURNED}_CANCELLEDSTATUS_STARTED_CANCELLEDmeans that cancellation happened before the parameters were received, e.g. theSTARTEDstate was never reached.STATUS_RETURNED_CANCELLEDmeans that cancellation happened after the parameters were received, e.g. theRETURNEDstate was never reached.EventCode.CANCELLEDis addedI suspect I'm missing a lot of details here still as well.