Skip to content
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

Clarify poll with empty list #67

Closed
badeend opened this issue Jan 24, 2024 · 2 comments · Fixed by bytecodealliance/wasmtime#7944 · May be fixed by bytecodealliance/wasmtime#7812 or #69
Closed

Clarify poll with empty list #67

badeend opened this issue Jan 24, 2024 · 2 comments · Fixed by bytecodealliance/wasmtime#7944 · May be fixed by bytecodealliance/wasmtime#7812 or #69

Comments

@badeend
Copy link
Contributor

badeend commented Jan 24, 2024

The spec doesn't explicitly mention what should happen when poll is called with an empty list. Should it return immediately, block forever, or trap? With the current specification I can see people interpreting it either way. I certainly did.

I tried Googling for what native platforms do. On Windows, WSAPoll requires there to be at least one item. Linux and FreeBSD don't mention it in their documentation. Even StackOverflow etc don't have any useful info on this. So it appears that this is a pretty obscure edge case, which makes me think trapping might be the "best" option.

The current Wasmtime implementation hangs indefinitely.

@pchickey
Copy link
Contributor

pchickey commented Jan 24, 2024

That is a really good question! My preference is to treat an empty list of pollables as an illegal input, specify that case will trap. Hanging indefinitely doesn't do any favors for either implementors or users. Compared to trapping, I'm less in favor of returning immediately, because that doesn't seem to meet the spirit of blocking until at least one pollable is ready, and so it allows users to keep the invariant that at least one element is returned.

@appcypher
Copy link

This issue should still be open for #69 to be merged.
It was closed by the wrong PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants