Consider the following scenario: we have two components, A and B. B relies on A, i.e A is a library. Both A and B wanna subscribe to pollables, A to pollables provided by the host, and B to pollables provided by A. Can they do it without blocking each other?
My understanding is that subscribing to pollables is a blocking operation. And since both A and B run on the same thread, having them both subscribe to pollables is impossible.
Am I wrong about this? Is there any way around this problem?
Also, will wasip3 solve this somehow?
Correct -- the only way to compose concurrent components in WASIp2 is for them to coordinate by having one call poll
with pollable
s from both of them (i.e. one would have to pass its pollable
s to the other). This is extremely awkward and not practical in general, which is why WASIp3 will instead use the new async ABI as the basis for concurrency, making async composition as easy as sync composition.
See also Luke Wagner's async presentation videos and https://github.com/dicej/rfcs/blob/component-async/accepted/component-model-async.md#motivation
Thanks for clarifying this @Joel Dice!
Last updated: Dec 23 2024 at 12:05 UTC