bytecodealliance / bytecodealliance/wasmtime

`fd_fdstat_set_flags` requires mutable access to the file descriptor table

Open
#5,643 0 comments 0 reactions 0 assignees View on GitHub
wasm-proposal:threads
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 19h
Merged PRs (30d)
121

Description

In https://github.com/bytecodealliance/wasmtime/pull/5326, we discussed [extensively](https://github.com/bytecodealliance/wasmtime/pull/5326#discussion_r1033699107) how to resolve the build errors related to `fd_fdstat_set_flags`, a `wasi-common` function. When attempting to apply locking to `wasi-common` to enable multi-threaded access, this function was the sole remaining issue preventing the implementation of `WasiSnapshotPreview1` from using `&self` (what we wanted to switch to) instead of the current `&mut self`. If `fd_fdstat_set_flags` could take `&self` instead, this would result in a variety of benefits:
- there would be no need to wrap `WasiCtx` (and friends) in an inner structure containing an `Arc`; the `Arc` could be applied to the top-level `Host` structure instead
- all of `WasiSnapshotPreview1` could be implemented in terms of `&self` instead of `&mut self`
- several supporting `derive(Clone)` and mutating functions could go away

At some point I had heard of discussions to modify this API; if and when that happens, the above improvements could be made.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.