authorgravatar for leroycepearson@geemili.xyzLeRoyce Pearson <leroycepearson@geemili.xyz> 2020-04-11 15:24:20-06:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-05-25 13:48:43-04:00
log73d2747084e92b2907ecf71f180a955ec411975e
tree7e4e8a9e0384d8b52ed2a93e337a308191d51fff
parent204aa7dc1a183bb5fba91328d4f436c6f91471af

Open file with exclusive lock


1 files changed, 6 insertions(+), 2 deletions(-)

lib/std/cache_hash.zig+6-2
......@@ -139,7 +139,11 @@ pub const CacheHash = struct {
139139 const manifest_file_path = try fmt.allocPrint(self.alloc, "{}.txt", .{self.b64_digest});
140140 defer self.alloc.free(manifest_file_path);
141141
142 self.manifest_file = try self.manifest_dir.createFile(manifest_file_path, .{ .read = true, .truncate = false });
142 self.manifest_file = try self.manifest_dir.createFile(manifest_file_path, .{
143 .read = true,
144 .truncate = false,
145 .lock = .Exclusive,
146 });
143147 }
144148
145149 // TODO: Figure out a good max value?
......@@ -213,7 +217,7 @@ pub const CacheHash = struct {
213217
214218 if (any_file_changed) {
215219 // cache miss
216 // keep the manifest file open (TODO: with rw lock)
220 // keep the manifest file open
217221 // reset the hash
218222 self.blake3 = Blake3.init();
219223 self.blake3.update(&bin_digest);