-
Notifications
You must be signed in to change notification settings - Fork 4
Rename poll_oneoff to poll_list, add poll_one #22
Comments
On the topic of changing these APIs: in addition to renaming, I'd suggest returning a list-of-ready-indices (instead of a list-of-bools) and/or having a poll that takes a list and returns a single pollable index (avoiding list allocation in the common single-ready case). |
Wearing my functional safety hat I want to avoid all allocations at runtime, because they easily introduce unpredictable delays into the system (unless you replace the allocator with a more complex bounded time implementation). So I wish there were also a non-allocating variant of this call, my proposal would be to add a non-allocating variant for the common up-to-64-pollables case: poll_up_to64: func (in: list<pollable>) -> bitflags64 Of course this involves adding a way to express constant size list as bitflags. (I am mostly concerned about the main loop of a service implementation where this function constantly polls which input stream to process next and might often return without a wait) Update: Removed the borrow from the signature as it is default for imported functions. |
In WebAssembly/wasi-io#46 I'm proposing to do the rename of poll-oneoff to poll-list and make it return a list of indices, and add poll-one. I have not yet proposed any changes for the single-ready case. In any approach where we return fewer events than have actually occurred, an implementation would need to associate a buffer of pending events for each pollable, which would add some complexity, so I've chosen to defer that for now. I also have not yet proposed any changes for |
- Convert to resources. Use resources instead of `u32`s, remove drop functions, `this` arguments, and rename `subscribe-to-*` to just `subscribe`, as discussed in WebAssembly/wasi-poll#21. - Merge wasi-poll into wasi-io. These two proposals are closely related to each other, so it makes sense to have them together. - While here, tidy up the poll API, incorporating ideas discussed in WebAssembly/wasi-poll#22: - Rename `poll-oneoff` to `poll-list`, and add a `poll-one`. - Change `poll-oneoff`'s return type from `list<bool>` to `list<u32>`, because in the common case, this should allow it to create much smaller allocations.
* Convert to Resources, and other API cleanups. - Convert to resources. Use resources instead of `u32`s, remove drop functions, `this` arguments, and rename `subscribe-to-*` to just `subscribe`, as discussed in WebAssembly/wasi-poll#21. - Merge wasi-poll into wasi-io. These two proposals are closely related to each other, so it makes sense to have them together. - While here, tidy up the poll API, incorporating ideas discussed in WebAssembly/wasi-poll#22: - Rename `poll-oneoff` to `poll-list`, and add a `poll-one`. - Change `poll-oneoff`'s return type from `list<bool>` to `list<u32>`, because in the common case, this should allow it to create much smaller allocations. * Update to WebAssembly/wit-abi-up-to-date@v14. * Remove the wit-deps check now that we have no dependencies. * Fix more references to `poll-oneoff`. * Mark `poll` arguments as borrowed. * Update to wit-abi-up-to-date@v15.
WebAssembly/wasi-io#46 has renamed poll_oneoff to poll_list, and added a poll_one. I didn't yet add a poll_up_to64; feel free to file an issue in the wasi-io issue tracker to discuss this. |
The name "oneoff" was never very evocative, so I propose we rename it to
poll_list
because it polls a list of pollables.Also, for convenience because it's a common case when writing simple examples and when compiling blocking code, I propose we add a
poll_one
function that just takes one pollable.I'd ideally like to make these changes at the same time as converting to resources, to minimize churn in downstream users.
The text was updated successfully, but these errors were encountered: