@@ -500,8 +500,8 @@ incremented so that the correct counter can be decremented.
500500
501501Once an async call has started, blocked and been added to the caller's table of
502502waitables, the caller may decide that it no longer needs the results or effects
503- of the subtask and ** cancel** the subtask by calling the [ ` subtask.cancel ` ]
504- built-in.
503+ of the subtask. In this case, the caller may ** cancel** the subtask by calling
504+ the [ ` subtask.cancel ` ] built-in.
505505
506506Once cancellation is requested, since the subtask may have already racily
507507returned a value, the caller may still receive a return value. However, the
@@ -531,16 +531,17 @@ Thus, the `subtask.cancel` built-in can block and works just like an import
531531call in that it can be called synchronously or asynchronously.
532532
533533On the callee side of cancellation: when a caller requests cancellation via
534- ` subtask.cancel ` , the callee receives a [ ` TASK_CANCELLED ` ] event (produced by
535- one of the ` waitable-set.{wait,poll} ` or ` yield ` built-ins). Upon receiving
536- notice of cancellation, the callee can call the [ ` task.cancel ` ] built-in to
537- resolve the subtask without returning a value or the callee can call
538- [ ` task.return ` ] as-if there were no cancellation. ` task.cancel ` doesn't take a
539- value to return but does enforce the same [ borrow] ( #borrows ) rules as
540- ` task.return ` . Ideally, a callee will ` task.cancel ` itself as soon as possible
541- after receiving a ` TASK_CANCELLED ` event so that any caller waiting for the
542- recovery of lent handles is unblocked ASAP. As with ` task.return ` , after
543- calling ` task.cancel ` , a callee can continue executing before exiting the task.
534+ ` subtask.cancel ` , the callee receives a [ ` TASK_CANCELLED ` ] event (as produced
535+ by one of the ` waitable-set.{wait,poll} ` or ` yield ` built-ins or as received by
536+ the ` callback ` function). Upon receiving notice of cancellation, the callee can
537+ call the [ ` task.cancel ` ] built-in to resolve the subtask without returning a
538+ value. Alternatively, the callee can still call [ ` task.return ` ] as-if there
539+ were no cancellation. ` task.cancel ` doesn't take a value to return but does
540+ enforce the same [ borrow] ( #borrows ) rules as ` task.return ` . Ideally, a callee
541+ will ` task.cancel ` itself as soon as possible after receiving a
542+ ` TASK_CANCELLED ` event so that any caller waiting for the recovery of lent
543+ handles is unblocked ASAP. As with ` task.return ` , after calling ` task.cancel ` ,
544+ a callee can continue executing before exiting the task.
544545
545546See the [ ` canon_subtask_cancel ` ] and [ ` canon_task_cancel ` ] functions in the
546547Canonical ABI explainer for more details.
0 commit comments