StarlingMonkey icon indicating copy to clipboard operation
StarlingMonkey copied to clipboard

feat: single-tick non-tracking event loop runner

Open guybedford opened this issue 8 months ago • 1 comments

ComponentizeJS will run the event loop without interest as a way to ensure that async work is being done.

We do this in the post_call for functions so that the event loop is able to progress, without that affecting the primary exported function behaviour.

Certainly with async support this picture will change, but even with async support there is the concept I think this concept of "running a single tick" is useful.

The problem is that running a single tick does not do any task selection due to the risk of blocking. Thus, this PR implements a non-blocking ready call as an alternative to select in the specific situation when you are running the event loop without async interest explicitly registered. This allows things like timeouts and other events that aren't tracked to still complete when they are ready without causing unnecessary blocking.

I think this is a worthwhile use case for seeing https://github.com/WebAssembly/wasi-io/pull/75 implemented as well.

guybedford avatar May 29 '24 22:05 guybedford