@@ -78,12 +78,11 @@ these languages' concurrency features are already bound (making the Component
78
78
Model "just another OS" from the language toolchains' perspective).
79
79
80
80
Moreover, this async ABI does not require components to use preemptive
81
- multi-threading ([ ` thread.spawn ` ] ) in order to achieve concurrency. Instead,
82
- concurrency can be achieved by cooperatively switching between different
83
- logical tasks running on a single thread. This switching may require the use of
84
- [ fibers] or a [ CPS transform] , but may also be avoided entirely when a
85
- component's producer toolchain is engineered to always return to an
86
- [ event loop] .
81
+ multi-threading ([ ` thread.spawn* ` ] ) in order to achieve concurrency. Instead,
82
+ concurrency can be achieved by cooperatively switching between different logical
83
+ tasks running on a single thread. This switching may require the use of [ fibers]
84
+ or a [ CPS transform] , but may also be avoided entirely when a component's
85
+ producer toolchain is engineered to always return to an [ event loop] .
87
86
88
87
To avoid partitioning the world along sync/async lines as mentioned in the
89
88
Goals section, the Component Model allows * every* component-level function type
@@ -672,11 +671,11 @@ by declarative instantiation and `start` above.
672
671
673
672
## Interaction with multi-threading
674
673
675
- For now, the integration between multi-threading (via [ ` thread.spawn ` ] ) and
676
- native async is limited. In particular, because all [ lift and lower
677
- definitions ] produce non-` shared ` functions, any threads spawned by a component
678
- via ` thread.spawn ` will not be able to directly call imports (synchronously
679
- * or * asynchronously) and will thus have to use Core WebAssembly ` atomics.* `
674
+ For now, the integration between multi-threading (via [ ` thread.spawn* ` ] ) and
675
+ native async is limited. In particular, because all [ lift and lower definitions ]
676
+ produce non-` shared ` functions, any threads spawned by a component via
677
+ ` thread.spawn* ` will not be able to directly call imports (synchronously * or *
678
+ asynchronously) and will thus have to use Core WebAssembly ` atomics.* `
680
679
instructions to switch back to a non-` shared ` function running on the "main"
681
680
thread (i.e., whichever thread was used to call the component's exports).
682
681
@@ -693,8 +692,8 @@ composition story described above could naturally be extended to a
693
692
sync+async+shared composition story, continuing to avoid the "what color is
694
693
your function" problem (where ` shared ` is the [ color] ).
695
694
696
- Even without any use of ` thread.new ` , native async provides an opportunity to
697
- achieve some automatic parallelism "for free". In particular, due to the
695
+ Even without any use of [ ` thread.spawn* ` ] , native async provides an opportunity
696
+ to achieve some automatic parallelism "for free". In particular, due to the
698
697
shared-nothing nature of components, each component instance could be given a
699
698
separate thread on which to interleave all tasks executing in that instance.
700
699
Thus, in a cross-component call from ` C1 ` to ` C2 ` , ` C2 ` 's task can run in a
@@ -750,7 +749,7 @@ comes after:
750
749
[ `yield` ] : Explainer.md#-yield
751
750
[ `waitable-set.wait` ] : Explainer.md#-waitable-setwait
752
751
[ `waitable-set.poll` ] : Explainer.md#-waitable-setpoll
753
- [ `thread.spawn` ] : Explainer.md#-threadspawn
752
+ [ `thread.spawn* ` ] : Explainer.md#-threadspawnref
754
753
[ ESM-integration ] : Explainer.md#ESM-integration
755
754
756
755
[ Canonical ABI Explainer ] : CanonicalABI.md
0 commit comments