| ... | @@ -762,7 +762,11 @@ pub const Manifest = struct { | ... | @@ -762,7 +762,11 @@ pub const Manifest = struct { |
| 762 | | 762 | |
| 763 | fn downgradeToSharedLock(self: *Manifest) !void { | 763 | fn downgradeToSharedLock(self: *Manifest) !void { |
| 764 | if (!self.have_exclusive_lock) return; | 764 | if (!self.have_exclusive_lock) return; |
| 765 | if (std.process.can_spawn or !builtin.single_threaded) { // Some targets (WASI) do not support flock | 765 | |
| | 766 | // WASI does not currently support flock, so we bypass it here. |
| | 767 | // TODO: If/when flock is supported on WASI, this check should be removed. |
| | 768 | // See https://github.com/WebAssembly/wasi-filesystem/issues/2 |
| | 769 | if (builtin.os.tag != .wasi or std.process.can_spawn or !builtin.single_threaded) { |
| 766 | const manifest_file = self.manifest_file.?; | 770 | const manifest_file = self.manifest_file.?; |
| 767 | try manifest_file.downgradeLock(); | 771 | try manifest_file.downgradeLock(); |
| 768 | } | 772 | } |
| ... | @@ -771,7 +775,11 @@ pub const Manifest = struct { | ... | @@ -771,7 +775,11 @@ pub const Manifest = struct { |
| 771 | | 775 | |
| 772 | fn upgradeToExclusiveLock(self: *Manifest) !void { | 776 | fn upgradeToExclusiveLock(self: *Manifest) !void { |
| 773 | if (self.have_exclusive_lock) return; | 777 | if (self.have_exclusive_lock) return; |
| 774 | if (std.process.can_spawn or !builtin.single_threaded) { // Some targets (WASI) do not support flock | 778 | |
| | 779 | // WASI does not currently support flock, so we bypass it here. |
| | 780 | // TODO: If/when flock is supported on WASI, this check should be removed. |
| | 781 | // See https://github.com/WebAssembly/wasi-filesystem/issues/2 |
| | 782 | if (builtin.os.tag != .wasi or std.process.can_spawn or !builtin.single_threaded) { |
| 775 | const manifest_file = self.manifest_file.?; | 783 | const manifest_file = self.manifest_file.?; |
| 776 | // Here we intentionally have a period where the lock is released, in case there are | 784 | // Here we intentionally have a period where the lock is released, in case there are |
| 777 | // other processes holding a shared lock. | 785 | // other processes holding a shared lock. |