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.
In #5326, we discussed extensively how to resolve the build errors related to
fd_fdstat_set_flags, awasi-commonfunction. When attempting to apply locking towasi-commonto enable multi-threaded access, this function was the sole remaining issue preventing the implementation ofWasiSnapshotPreview1from using&self(what we wanted to switch to) instead of the current&mut self. Iffd_fdstat_set_flagscould take&selfinstead, this would result in a variety of benefits:WasiCtx(and friends) in an inner structure containing anArc; theArccould be applied to the top-levelHoststructure insteadWasiSnapshotPreview1could be implemented in terms of&selfinstead of&mut selfderive(Clone)and mutating functions could go awayAt some point I had heard of discussions to modify this API; if and when that happens, the above improvements could be made.