-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ordering constraints on indices returned by wasi:io/poll/poll
?
#58
Comments
Could you say more about why first-in-first-ready-out order would be useful? It's nondeterministic whether two events happening around the same time are reported in the same Another subtlety is that it's currently possible to pass the same pollable multiple times to a single |
Actually after discussing this with @elliottt I actually think that in-order-of-readiness is the right thing to do here, not ascending order. The latter can trivially be derived by sorting the list, whereas the former gives additional information. @sunfishcode I of course agree that guests should be ready to process events in any order. The (now, based on the thought from the previous paragraph) question is can we give any additional useful information. I think we potentially can, by including something like the following language in the definition:
Why would we do this? I can imagine situations in which two pollables have some implicit, unexpressed ordering constraint that means they always become ready in a specific order, and where that order is equally implicitly expected in the event loop processing the pollables. I guess that'd argue for either turning the first But regardless of the outcome, I do think we should say something here, because I'm pretty sure this is one of those things where implementation-defined behavior will eventually come to bite us. |
Ah, yet another thing that I think we should mandate some behavior. Coalescing makes sense to me, and if some implementations do so, we should either mandate or disallow it. |
Implementations based on Unix-style I can see the benefits to randomizing, in promoting portability and exposing subtle ordering bugs earlier. That said, requiring randomization would prevent So, what if we added wording to the spec saying that the order of items returned by |
The
wasi:io/poll/poll
function returns a list of indices into the list of pollables that was passed in to indicate readiness for them. Currently it's not documented which order these indices should appear in, so e.g.[3,1,0,2]
would seemingly be a valid response.Can we document the required order, and can we ideally require that the indices should be in ascending order? That'd make it more straight-forward to use the list of pollables as an event queue that is processed in first-in, first-(ready-)out order.
The text was updated successfully, but these errors were encountered: