Description
Hi CLC members! Based on my recent work in the ghc wasm backend, I would like to make a wasm-specific proposal. The high level tl;dr is simple: on wasm32, treat all FDs as "nonblocking" unconditionally, therefore always performing the underlying read/write operation directly while avoiding the usage of poll()
to actually wait for the FD's readiness. This makes I/O much more robust on wasm32, especially in browsers, where there's no satisfactory implementation of the poll_oneoff
wasi syscall.
This has already been implemented in http://gitlab.haskell.org/ghc/ghc/-/merge_requests/11697. The patch only affects the wasm32
platform and doesn't touch any other platforms, while fixing a few test cases previously marked as fragile on wasm32
. The merge request contains more detailed explanations, so I'd like to use that as the source of truth for the time being, but feel free to ask any questions or require more clarifications here :)