aboutsummaryrefslogtreecommitdiff
path: root/src/Cache.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-04-19 13:30:15 -0400
committerGitHub <noreply@github.com>2022-04-19 13:30:15 -0400
commit78f26b970e1c5c288e45d0edd2ab2f229e6fe924 (patch)
tree8233f52a95ffba1b92661ea5d3bdf989c00950ff /src/Cache.zig
parent535d5624e48e31752729d00c469aca504cf50091 (diff)
parentf8dc6fc416d27bc6d93d79689823a4278aacd5b2 (diff)
downloadzig-78f26b970e1c5c288e45d0edd2ab2f229e6fe924.tar.gz
zig-78f26b970e1c5c288e45d0edd2ab2f229e6fe924.zip
Merge pull request #11469 from topolarity/wasm-fixup
stage2: Move `selfExePathWasi` to `introspect.zig`
Diffstat (limited to 'src/Cache.zig')
-rw-r--r--src/Cache.zig12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Cache.zig b/src/Cache.zig
index 37cd7a7529..0d4b51492d 100644
--- a/src/Cache.zig
+++ b/src/Cache.zig
@@ -762,7 +762,11 @@ pub const Manifest = struct {
fn downgradeToSharedLock(self: *Manifest) !void {
if (!self.have_exclusive_lock) return;
- if (std.process.can_spawn or !builtin.single_threaded) { // Some targets (WASI) do not support flock
+
+ // WASI does not currently support flock, so we bypass it here.
+ // TODO: If/when flock is supported on WASI, this check should be removed.
+ // See https://github.com/WebAssembly/wasi-filesystem/issues/2
+ if (builtin.os.tag != .wasi or std.process.can_spawn or !builtin.single_threaded) {
const manifest_file = self.manifest_file.?;
try manifest_file.downgradeLock();
}
@@ -771,7 +775,11 @@ pub const Manifest = struct {
fn upgradeToExclusiveLock(self: *Manifest) !void {
if (self.have_exclusive_lock) return;
- if (std.process.can_spawn or !builtin.single_threaded) { // Some targets (WASI) do not support flock
+
+ // WASI does not currently support flock, so we bypass it here.
+ // TODO: If/when flock is supported on WASI, this check should be removed.
+ // See https://github.com/WebAssembly/wasi-filesystem/issues/2
+ if (builtin.os.tag != .wasi or std.process.can_spawn or !builtin.single_threaded) {
const manifest_file = self.manifest_file.?;
// Here we intentionally have a period where the lock is released, in case there are
// other processes holding a shared lock.