-
-
Notifications
You must be signed in to change notification settings - Fork 57
poll_oneoff() implementation #12
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
Comments
I guess you could create a new loop, put all poll handles in there and wait for it to finish, then return. Somewhat akin to what Node does for spawnSync, IIRC. Now, if socket calls are going away what stuff can one poll on, just timers? |
According to the docs, you can poll on Unfortunately, from what I can tell, the WASI API wasn't designed with first class Windows support in mind. |
I see. The fun fact is that in it's current shape we can't use So that leaves timers. Maybe a good starting point is to just implement timers and claim that any other event type is always ready? Also thinking out loud here :-) |
For reference, here is how wasmtime implemented it: https://github.com/CraneStation/wasmtime/blob/e530a582afe6a2b5735fd7cdf5e2e88391e58669/wasmtime-wasi-c/sandboxed-system-primitives/src/posix.c#L2303-L2530 And this is how Gus implemented it in JavaScript: https://github.com/devsnek/node-wasi/blob/12a0985a46589587facd8d8e161911650ef15f3b/src/index.js#L1169-L1247. I'm not sure if the JS version works or not, given that the poll test is skipped in that repo. |
Hi @saghul 👋 I've been revisiting this lately. I think I have an implementation based on
|
Yeah!
That might work. But since you also need to keep track of the fds (right?) maybe just remeember them and edit the event mask, then rearm the poll handle? |
Yes, there is a fair amount of state, including the fds, to track. I'm going to try your suggestion. Thanks! |
The implementation is currently limited by what uv_poll_t's support. Fixes: #12
The implementation is currently limited by what uv_poll_t's support. Fixes: #12
This and the sockets calls (which might be going away from WASI anyway) are the only completely unimplemented calls.
I'm still trying to figure out the best way forward here. From what I can tell, this is a synchronous call, so I'm not sure that
uv_poll_t
can be used.Also, as @saghul pointed out in nodejs/wasi#21 (comment), polling non-sockets on Windows could be an issue.
The text was updated successfully, but these errors were encountered: