@@ -164,16 +164,15 @@ when a component exports asynchronously-lifted functions, there can be multiple
164
164
tasks alive at once.
165
165
166
166
In the Canonical ABI explainer, a "task" is represented with the Python
167
- [ ` Task ` ] class, which is created by each call to [ ` canon_lift ` ] and has
168
- ` SyncTask ` and ` AsyncTask ` subclasses to factor out state and behavior only
169
- needed for sync- or async-lifted functions, resp.
167
+ [ ` Task ` ] class. A new ` Task ` object is created (by [ ` canon_lift ` ] ) each time
168
+ a component export is called.
170
169
171
170
### Current Task
172
171
173
172
At any point in time when executing in Core WebAssembly code, there is a
174
- single, unambiguous ** current task** . Thus, whenever a [ canonical built-in] is
175
- called by Core WebAssembly code, it is meaningful for the built-in to work in
176
- terms "the current task".
173
+ well-defined ** current task** . Thus, whenever a [ canonical built-in] is called
174
+ by Core WebAssembly code, it is meaningful for the built-in to work in terms
175
+ "the current task".
177
176
178
177
The "current task" is modelled in the Canonical ABI's Python code
179
178
by implicitly threading the ` Task ` object created by [ ` canon_lift ` ] through all
@@ -192,7 +191,7 @@ is destroyed).
192
191
193
192
The Canonical ABI's Python code represents the subtask relationship between a
194
193
caller ` Task ` and a callee ` Task ` via the Python [ ` Subtask ` ] class. Whereas a
195
- ` Task ` object is created by each call to ` canon_lift ` , a ` Subtask ` object is
194
+ ` Task ` object is created by each call to [ ` canon_lift ` ] , a ` Subtask ` object is
196
195
created by each call to [ ` canon_lower ` ] . This allows ` Subtask ` s to store the
197
196
state that enforces the caller side of the Canonical ABI rules.
198
197
@@ -315,6 +314,9 @@ above). However, there is always *some* parent `Task` and this parent `Task`
315
314
is prevented from orphaning its children using the same reference-counting
316
315
guard mentioned above for subtasks.
317
316
317
+ The [ Stream State] and [ Future State] sections describe the runtime state
318
+ maintained for streams and futures by the Canonical ABI.
319
+
318
320
### Waiting
319
321
320
322
When a component asynchronously lowers an import, it is explicitly requesting
@@ -344,6 +346,9 @@ same thing which, in the Canonical ABI Python code, is factored out into
344
346
[ ` Task ` ] 's ` wait ` method. Thus, the difference between ` callback ` and
345
347
non-` callback ` is mostly one of optimization, not expressivity.
346
348
349
+ The Canonical ABI Python represents waitables with a common [ ` Waitable ` ]
350
+ base class.
351
+
347
352
### Backpressure
348
353
349
354
Once a component exports asynchronously-lifted functions, multiple concurrent
@@ -630,15 +635,17 @@ comes after:
630
635
631
636
[ Canonical ABI Explainer ] : CanonicalABI.md
632
637
[ `canon_lift` ] : CanonicalABI.md#canon-lift
638
+ [ `canon_lift` ] : CanonicalABI.md#canon-lift
633
639
[ `canon_lower` ] : CanonicalABI.md#canon-lower
634
- [ `canon_lower` ] : CanonicalABI.md#canon-task-wait
635
640
[ `canon_task_wait` ] : CanonicalABI.md#-canon-taskwait
636
641
[ `canon_task_backpressure` ] : CanonicalABI.md#-canon-taskbackpressure
637
642
[ `canon_task_return` ] : CanonicalABI.md#-canon-taskreturn
638
- [ `Task` ] : CanonicalABI.md#runtime-state
639
- [ `Task.enter` ] : CanonicalABI.md#runtime-state
640
- [ `Subtask` ] : CanonicalABI.md#runtime-state
641
- [ `AsyncTask` ] : CanonicalABI.md#runtime-state
643
+ [ `Task` ] : CanonicalABI.md#task-state
644
+ [ `Task.enter` ] : CanonicalABI.md#task-state
645
+ [ `Waitable` ] : CanonicalABI.md#waitable-state
646
+ [ `Subtask` ] : CanonicalABI.md#subtask-state
647
+ [ Stream State ] : CanonicalABI.md#stream-state
648
+ [ Future State ] : CanonicalABI.md#future-state
642
649
643
650
[ Binary Format ] : Binary.md
644
651
[ WIT ] : WIT.md
0 commit comments