WebAssembly / component-model

Repository for design and specification of the Component Model
Other
899 stars 75 forks source link

Add canonical `thread.*` builtins #291

Closed abrown closed 4 months ago

abrown commented 6 months ago

This change adds the thread.spawn and thread.hw_concurrency builtins in line with what was proposed in the shared-everything threads proposal.

badeend commented 5 months ago

I assume that any parallelism introduced by these built-ins are contained to the component instance that spawned them, and that cross-component communication (including client<->host) is still required to be fully sequential in order to comply with the component invariants.

It might be worthwhile to throw in a quick clarification of this under the new Threads section in the explainer.

lukewagner commented 5 months ago

@badeend That's correct yes. A future (more extensive) extension to the C-M would be to add shared attributes to component-level functions so that they could be lifted-from or lowered-to shared core functions but, until we add that, lowering a (non-shared) component-level function necessarily produces a (non-shared) core function which does end up forcing serialization back to the "main" (entry) thread for cross-component calls.

lukewagner commented 4 months ago

I think all the actionable feedback has been addressed, so I'll plan to merge at the end of the week unless anything new comes up.