Skip to content

fd_fdstat_set_flags requires mutable access to the file descriptor table #5643

@abrown

Description

@abrown

In #5326, we discussed extensively 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wasm-proposal:threadsIssues related to the WebAssembly threads proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions