wasi-io icon indicating copy to clipboard operation
wasi-io copied to clipboard

poll_list timeouts

Open guybedford opened this issue 1 year ago • 2 comments

Was it ever discussed to support direct timeout args to poll_list?

Typically to avoid possibly blocking on a long-running task when there are no immediate tasks, one has to create a short timeout, then add that to the list for each call to poll_list, resulting in an extra host call per iteration.

guybedford avatar Apr 24 '24 21:04 guybedford

The intended way to do this is to request a pollable from wasi:clocks/monotonic-clock, such as subscribe-instant or subscribe_duration, and add that to the list passed to poll_list.

sunfishcode avatar May 24 '24 22:05 sunfishcode

Ah, to answer your question, no, we haven't looked at adding a timeout directly to poll_list. But if there are use cases where the extra host call per iteration is significant, I think we'd be open to considering adding a form of poll_list with a timeout.

sunfishcode avatar May 24 '24 22:05 sunfishcode