Closed abrown closed 4 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.
@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.
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.
This change adds the
thread.spawn
andthread.hw_concurrency
builtins in line with what was proposed in the shared-everything threads proposal.