| author | |
| committer | |
| log | ba35eeb417e4d54ce4c559871b9330bc95afc053 |
| tree | 280c28c4deda5fb30b84e84128caa0999a631b89 |
| parent | 4159add4abe92e903d8797a005344d8325def2fc |
5 files changed, 57 insertions(+), 53 deletions(-)
lib/std/Build/Cache.zig+3-3| ... | @@ -408,7 +408,7 @@ pub const Manifest = struct { | ... | @@ -408,7 +408,7 @@ pub const Manifest = struct { |
| 408 | if (self.cache.manifest_dir.createFile(&manifest_file_path, .{ | 408 | if (self.cache.manifest_dir.createFile(&manifest_file_path, .{ |
| 409 | .read = true, | 409 | .read = true, |
| 410 | .truncate = false, | 410 | .truncate = false, |
| 411 | .lock = .Exclusive, | 411 | .lock = .exclusive, |
| 412 | .lock_nonblocking = self.want_shared_lock, | 412 | .lock_nonblocking = self.want_shared_lock, |
| 413 | })) |manifest_file| { | 413 | })) |manifest_file| { |
| 414 | self.manifest_file = manifest_file; | 414 | self.manifest_file = manifest_file; |
| ... | @@ -418,7 +418,7 @@ pub const Manifest = struct { | ... | @@ -418,7 +418,7 @@ pub const Manifest = struct { |
| 418 | error.WouldBlock => { | 418 | error.WouldBlock => { |
| 419 | self.manifest_file = try self.cache.manifest_dir.openFile(&manifest_file_path, .{ | 419 | self.manifest_file = try self.cache.manifest_dir.openFile(&manifest_file_path, .{ |
| 420 | .mode = .read_write, | 420 | .mode = .read_write, |
| 421 | .lock = .Shared, | 421 | .lock = .shared, |
| 422 | }); | 422 | }); |
| 423 | break; | 423 | break; |
| 424 | }, | 424 | }, |
| ... | @@ -885,7 +885,7 @@ pub const Manifest = struct { | ... | @@ -885,7 +885,7 @@ pub const Manifest = struct { |
| 885 | // Here we intentionally have a period where the lock is released, in case there are | 885 | // Here we intentionally have a period where the lock is released, in case there are |
| 886 | // other processes holding a shared lock. | 886 | // other processes holding a shared lock. |
| 887 | manifest_file.unlock(); | 887 | manifest_file.unlock(); |
| 888 | try manifest_file.lock(.Exclusive); | 888 | try manifest_file.lock(.exclusive); |
| 889 | } | 889 | } |
| 890 | self.have_exclusive_lock = true; | 890 | self.have_exclusive_lock = true; |
| 891 | return true; | 891 | return true; |
lib/std/fs.zig+20-20| ... | @@ -1157,9 +1157,9 @@ pub const Dir = struct { | ... | @@ -1157,9 +1157,9 @@ pub const Dir = struct { |
| 1157 | else | 1157 | else |
| 1158 | 0; | 1158 | 0; |
| 1159 | os_flags |= switch (flags.lock) { | 1159 | os_flags |= switch (flags.lock) { |
| 1160 | .None => @as(u32, 0), | 1160 | .none => @as(u32, 0), |
| 1161 | .Shared => os.O.SHLOCK | nonblocking_lock_flag, | 1161 | .shared => os.O.SHLOCK | nonblocking_lock_flag, |
| 1162 | .Exclusive => os.O.EXLOCK | nonblocking_lock_flag, | 1162 | .exclusive => os.O.EXLOCK | nonblocking_lock_flag, |
| 1163 | }; | 1163 | }; |
| 1164 | } | 1164 | } |
| 1165 | if (@hasDecl(os.O, "LARGEFILE")) { | 1165 | if (@hasDecl(os.O, "LARGEFILE")) { |
| ... | @@ -1182,13 +1182,13 @@ pub const Dir = struct { | ... | @@ -1182,13 +1182,13 @@ pub const Dir = struct { |
| 1182 | // WASI doesn't have os.flock so we intetinally check OS prior to the inner if block | 1182 | // WASI doesn't have os.flock so we intetinally check OS prior to the inner if block |
| 1183 | // since it is not compiltime-known and we need to avoid undefined symbol in Wasm. | 1183 | // since it is not compiltime-known and we need to avoid undefined symbol in Wasm. |
| 1184 | if (builtin.target.os.tag != .wasi) { | 1184 | if (builtin.target.os.tag != .wasi) { |
| 1185 | if (!has_flock_open_flags and flags.lock != .None) { | 1185 | if (!has_flock_open_flags and flags.lock != .none) { |
| 1186 | // TODO: integrate async I/O | 1186 | // TODO: integrate async I/O |
| 1187 | const lock_nonblocking = if (flags.lock_nonblocking) os.LOCK.NB else @as(i32, 0); | 1187 | const lock_nonblocking = if (flags.lock_nonblocking) os.LOCK.NB else @as(i32, 0); |
| 1188 | try os.flock(fd, switch (flags.lock) { | 1188 | try os.flock(fd, switch (flags.lock) { |
| 1189 | .None => unreachable, | 1189 | .none => unreachable, |
| 1190 | .Shared => os.LOCK.SH | lock_nonblocking, | 1190 | .shared => os.LOCK.SH | lock_nonblocking, |
| 1191 | .Exclusive => os.LOCK.EX | lock_nonblocking, | 1191 | .exclusive => os.LOCK.EX | lock_nonblocking, |
| 1192 | }); | 1192 | }); |
| 1193 | } | 1193 | } |
| 1194 | } | 1194 | } |
| ... | @@ -1241,9 +1241,9 @@ pub const Dir = struct { | ... | @@ -1241,9 +1241,9 @@ pub const Dir = struct { |
| 1241 | const range_off: w.LARGE_INTEGER = 0; | 1241 | const range_off: w.LARGE_INTEGER = 0; |
| 1242 | const range_len: w.LARGE_INTEGER = 1; | 1242 | const range_len: w.LARGE_INTEGER = 1; |
| 1243 | const exclusive = switch (flags.lock) { | 1243 | const exclusive = switch (flags.lock) { |
| 1244 | .None => return file, | 1244 | .none => return file, |
| 1245 | .Shared => false, | 1245 | .shared => false, |
| 1246 | .Exclusive => true, | 1246 | .exclusive => true, |
| 1247 | }; | 1247 | }; |
| 1248 | try w.LockFile( | 1248 | try w.LockFile( |
| 1249 | file.handle, | 1249 | file.handle, |
| ... | @@ -1320,9 +1320,9 @@ pub const Dir = struct { | ... | @@ -1320,9 +1320,9 @@ pub const Dir = struct { |
| 1320 | else | 1320 | else |
| 1321 | 0; | 1321 | 0; |
| 1322 | const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) { | 1322 | const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) { |
| 1323 | .None => @as(u32, 0), | 1323 | .none => @as(u32, 0), |
| 1324 | .Shared => os.O.SHLOCK | nonblocking_lock_flag, | 1324 | .shared => os.O.SHLOCK | nonblocking_lock_flag, |
| 1325 | .Exclusive => os.O.EXLOCK | nonblocking_lock_flag, | 1325 | .exclusive => os.O.EXLOCK | nonblocking_lock_flag, |
| 1326 | } else 0; | 1326 | } else 0; |
| 1327 | 1327 | ||
| 1328 | const O_LARGEFILE = if (@hasDecl(os.O, "LARGEFILE")) os.O.LARGEFILE else 0; | 1328 | const O_LARGEFILE = if (@hasDecl(os.O, "LARGEFILE")) os.O.LARGEFILE else 0; |
| ... | @@ -1339,13 +1339,13 @@ pub const Dir = struct { | ... | @@ -1339,13 +1339,13 @@ pub const Dir = struct { |
| 1339 | // WASI doesn't have os.flock so we intetinally check OS prior to the inner if block | 1339 | // WASI doesn't have os.flock so we intetinally check OS prior to the inner if block |
| 1340 | // since it is not compiltime-known and we need to avoid undefined symbol in Wasm. | 1340 | // since it is not compiltime-known and we need to avoid undefined symbol in Wasm. |
| 1341 | if (builtin.target.os.tag != .wasi) { | 1341 | if (builtin.target.os.tag != .wasi) { |
| 1342 | if (!has_flock_open_flags and flags.lock != .None) { | 1342 | if (!has_flock_open_flags and flags.lock != .none) { |
| 1343 | // TODO: integrate async I/O | 1343 | // TODO: integrate async I/O |
| 1344 | const lock_nonblocking = if (flags.lock_nonblocking) os.LOCK.NB else @as(i32, 0); | 1344 | const lock_nonblocking = if (flags.lock_nonblocking) os.LOCK.NB else @as(i32, 0); |
| 1345 | try os.flock(fd, switch (flags.lock) { | 1345 | try os.flock(fd, switch (flags.lock) { |
| 1346 | .None => unreachable, | 1346 | .none => unreachable, |
| 1347 | .Shared => os.LOCK.SH | lock_nonblocking, | 1347 | .shared => os.LOCK.SH | lock_nonblocking, |
| 1348 | .Exclusive => os.LOCK.EX | lock_nonblocking, | 1348 | .exclusive => os.LOCK.EX | lock_nonblocking, |
| 1349 | }); | 1349 | }); |
| 1350 | } | 1350 | } |
| 1351 | } | 1351 | } |
| ... | @@ -1402,9 +1402,9 @@ pub const Dir = struct { | ... | @@ -1402,9 +1402,9 @@ pub const Dir = struct { |
| 1402 | const range_off: w.LARGE_INTEGER = 0; | 1402 | const range_off: w.LARGE_INTEGER = 0; |
| 1403 | const range_len: w.LARGE_INTEGER = 1; | 1403 | const range_len: w.LARGE_INTEGER = 1; |
| 1404 | const exclusive = switch (flags.lock) { | 1404 | const exclusive = switch (flags.lock) { |
| 1405 | .None => return file, | 1405 | .none => return file, |
| 1406 | .Shared => false, | 1406 | .shared => false, |
| 1407 | .Exclusive => true, | 1407 | .exclusive => true, |
| 1408 | }; | 1408 | }; |
| 1409 | try w.LockFile( | 1409 | try w.LockFile( |
| 1410 | file.handle, | 1410 | file.handle, |
lib/std/fs/file.zig+19-15| ... | @@ -81,7 +81,11 @@ pub const File = struct { | ... | @@ -81,7 +81,11 @@ pub const File = struct { |
| 81 | read_write, | 81 | read_write, |
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | pub const Lock = enum { None, Shared, Exclusive }; | 84 | pub const Lock = enum { |
| 85 | none, | ||
| 86 | shared, | ||
| 87 | exclusive, | ||
| 88 | }; | ||
| 85 | 89 | ||
| 86 | pub const OpenFlags = struct { | 90 | pub const OpenFlags = struct { |
| 87 | mode: OpenMode = .read_only, | 91 | mode: OpenMode = .read_only, |
| ... | @@ -110,7 +114,7 @@ pub const File = struct { | ... | @@ -110,7 +114,7 @@ pub const File = struct { |
| 110 | /// * Windows | 114 | /// * Windows |
| 111 | /// | 115 | /// |
| 112 | /// [1]: https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt | 116 | /// [1]: https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt |
| 113 | lock: Lock = .None, | 117 | lock: Lock = .none, |
| 114 | 118 | ||
| 115 | /// Sets whether or not to wait until the file is locked to return. If set to true, | 119 | /// Sets whether or not to wait until the file is locked to return. If set to true, |
| 116 | /// `error.WouldBlock` will be returned. Otherwise, the file will wait until the file | 120 | /// `error.WouldBlock` will be returned. Otherwise, the file will wait until the file |
| ... | @@ -174,7 +178,7 @@ pub const File = struct { | ... | @@ -174,7 +178,7 @@ pub const File = struct { |
| 174 | /// * Windows | 178 | /// * Windows |
| 175 | /// | 179 | /// |
| 176 | /// [1]: https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt | 180 | /// [1]: https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt |
| 177 | lock: Lock = .None, | 181 | lock: Lock = .none, |
| 178 | 182 | ||
| 179 | /// Sets whether or not to wait until the file is locked to return. If set to true, | 183 | /// Sets whether or not to wait until the file is locked to return. If set to true, |
| 180 | /// `error.WouldBlock` will be returned. Otherwise, the file will wait until the file | 184 | /// `error.WouldBlock` will be returned. Otherwise, the file will wait until the file |
| ... | @@ -1465,9 +1469,9 @@ pub const File = struct { | ... | @@ -1465,9 +1469,9 @@ pub const File = struct { |
| 1465 | if (is_windows) { | 1469 | if (is_windows) { |
| 1466 | var io_status_block: windows.IO_STATUS_BLOCK = undefined; | 1470 | var io_status_block: windows.IO_STATUS_BLOCK = undefined; |
| 1467 | const exclusive = switch (l) { | 1471 | const exclusive = switch (l) { |
| 1468 | .None => return, | 1472 | .none => return, |
| 1469 | .Shared => false, | 1473 | .shared => false, |
| 1470 | .Exclusive => true, | 1474 | .exclusive => true, |
| 1471 | }; | 1475 | }; |
| 1472 | return windows.LockFile( | 1476 | return windows.LockFile( |
| 1473 | file.handle, | 1477 | file.handle, |
| ... | @@ -1486,9 +1490,9 @@ pub const File = struct { | ... | @@ -1486,9 +1490,9 @@ pub const File = struct { |
| 1486 | }; | 1490 | }; |
| 1487 | } else { | 1491 | } else { |
| 1488 | return os.flock(file.handle, switch (l) { | 1492 | return os.flock(file.handle, switch (l) { |
| 1489 | .None => os.LOCK.UN, | 1493 | .none => os.LOCK.UN, |
| 1490 | .Shared => os.LOCK.SH, | 1494 | .shared => os.LOCK.SH, |
| 1491 | .Exclusive => os.LOCK.EX, | 1495 | .exclusive => os.LOCK.EX, |
| 1492 | }) catch |err| switch (err) { | 1496 | }) catch |err| switch (err) { |
| 1493 | error.WouldBlock => unreachable, // non-blocking=false | 1497 | error.WouldBlock => unreachable, // non-blocking=false |
| 1494 | else => |e| return e, | 1498 | else => |e| return e, |
| ... | @@ -1532,9 +1536,9 @@ pub const File = struct { | ... | @@ -1532,9 +1536,9 @@ pub const File = struct { |
| 1532 | if (is_windows) { | 1536 | if (is_windows) { |
| 1533 | var io_status_block: windows.IO_STATUS_BLOCK = undefined; | 1537 | var io_status_block: windows.IO_STATUS_BLOCK = undefined; |
| 1534 | const exclusive = switch (l) { | 1538 | const exclusive = switch (l) { |
| 1535 | .None => return, | 1539 | .none => return, |
| 1536 | .Shared => false, | 1540 | .shared => false, |
| 1537 | .Exclusive => true, | 1541 | .exclusive => true, |
| 1538 | }; | 1542 | }; |
| 1539 | windows.LockFile( | 1543 | windows.LockFile( |
| 1540 | file.handle, | 1544 | file.handle, |
| ... | @@ -1553,9 +1557,9 @@ pub const File = struct { | ... | @@ -1553,9 +1557,9 @@ pub const File = struct { |
| 1553 | }; | 1557 | }; |
| 1554 | } else { | 1558 | } else { |
| 1555 | os.flock(file.handle, switch (l) { | 1559 | os.flock(file.handle, switch (l) { |
| 1556 | .None => os.LOCK.UN, | 1560 | .none => os.LOCK.UN, |
| 1557 | .Shared => os.LOCK.SH | os.LOCK.NB, | 1561 | .shared => os.LOCK.SH | os.LOCK.NB, |
| 1558 | .Exclusive => os.LOCK.EX | os.LOCK.NB, | 1562 | .exclusive => os.LOCK.EX | os.LOCK.NB, |
| 1559 | }) catch |err| switch (err) { | 1563 | }) catch |err| switch (err) { |
| 1560 | error.WouldBlock => return false, | 1564 | error.WouldBlock => return false, |
| 1561 | else => |e| return e, | 1565 | else => |e| return e, |
lib/std/fs/test.zig+11-11| ... | @@ -336,7 +336,7 @@ test "Dir.realpath smoke test" { | ... | @@ -336,7 +336,7 @@ test "Dir.realpath smoke test" { |
| 336 | var tmp_dir = tmpDir(.{}); | 336 | var tmp_dir = tmpDir(.{}); |
| 337 | defer tmp_dir.cleanup(); | 337 | defer tmp_dir.cleanup(); |
| 338 | 338 | ||
| 339 | var file = try tmp_dir.dir.createFile("test_file", .{ .lock = File.Lock.Shared }); | 339 | var file = try tmp_dir.dir.createFile("test_file", .{ .lock = .shared }); |
| 340 | // We need to close the file immediately as otherwise on Windows we'll end up | 340 | // We need to close the file immediately as otherwise on Windows we'll end up |
| 341 | // with a sharing violation. | 341 | // with a sharing violation. |
| 342 | file.close(); | 342 | file.close(); |
| ... | @@ -1035,10 +1035,10 @@ test "open file with exclusive nonblocking lock twice" { | ... | @@ -1035,10 +1035,10 @@ test "open file with exclusive nonblocking lock twice" { |
| 1035 | var tmp = tmpDir(.{}); | 1035 | var tmp = tmpDir(.{}); |
| 1036 | defer tmp.cleanup(); | 1036 | defer tmp.cleanup(); |
| 1037 | 1037 | ||
| 1038 | const file1 = try tmp.dir.createFile(filename, .{ .lock = .Exclusive, .lock_nonblocking = true }); | 1038 | const file1 = try tmp.dir.createFile(filename, .{ .lock = .exclusive, .lock_nonblocking = true }); |
| 1039 | defer file1.close(); | 1039 | defer file1.close(); |
| 1040 | 1040 | ||
| 1041 | const file2 = tmp.dir.createFile(filename, .{ .lock = .Exclusive, .lock_nonblocking = true }); | 1041 | const file2 = tmp.dir.createFile(filename, .{ .lock = .exclusive, .lock_nonblocking = true }); |
| 1042 | try testing.expectError(error.WouldBlock, file2); | 1042 | try testing.expectError(error.WouldBlock, file2); |
| 1043 | } | 1043 | } |
| 1044 | 1044 | ||
| ... | @@ -1050,10 +1050,10 @@ test "open file with shared and exclusive nonblocking lock" { | ... | @@ -1050,10 +1050,10 @@ test "open file with shared and exclusive nonblocking lock" { |
| 1050 | var tmp = tmpDir(.{}); | 1050 | var tmp = tmpDir(.{}); |
| 1051 | defer tmp.cleanup(); | 1051 | defer tmp.cleanup(); |
| 1052 | 1052 | ||
| 1053 | const file1 = try tmp.dir.createFile(filename, .{ .lock = .Shared, .lock_nonblocking = true }); | 1053 | const file1 = try tmp.dir.createFile(filename, .{ .lock = .shared, .lock_nonblocking = true }); |
| 1054 | defer file1.close(); | 1054 | defer file1.close(); |
| 1055 | 1055 | ||
| 1056 | const file2 = tmp.dir.createFile(filename, .{ .lock = .Exclusive, .lock_nonblocking = true }); | 1056 | const file2 = tmp.dir.createFile(filename, .{ .lock = .exclusive, .lock_nonblocking = true }); |
| 1057 | try testing.expectError(error.WouldBlock, file2); | 1057 | try testing.expectError(error.WouldBlock, file2); |
| 1058 | } | 1058 | } |
| 1059 | 1059 | ||
| ... | @@ -1065,10 +1065,10 @@ test "open file with exclusive and shared nonblocking lock" { | ... | @@ -1065,10 +1065,10 @@ test "open file with exclusive and shared nonblocking lock" { |
| 1065 | var tmp = tmpDir(.{}); | 1065 | var tmp = tmpDir(.{}); |
| 1066 | defer tmp.cleanup(); | 1066 | defer tmp.cleanup(); |
| 1067 | 1067 | ||
| 1068 | const file1 = try tmp.dir.createFile(filename, .{ .lock = .Exclusive, .lock_nonblocking = true }); | 1068 | const file1 = try tmp.dir.createFile(filename, .{ .lock = .exclusive, .lock_nonblocking = true }); |
| 1069 | defer file1.close(); | 1069 | defer file1.close(); |
| 1070 | 1070 | ||
| 1071 | const file2 = tmp.dir.createFile(filename, .{ .lock = .Shared, .lock_nonblocking = true }); | 1071 | const file2 = tmp.dir.createFile(filename, .{ .lock = .shared, .lock_nonblocking = true }); |
| 1072 | try testing.expectError(error.WouldBlock, file2); | 1072 | try testing.expectError(error.WouldBlock, file2); |
| 1073 | } | 1073 | } |
| 1074 | 1074 | ||
| ... | @@ -1085,13 +1085,13 @@ test "open file with exclusive lock twice, make sure second lock waits" { | ... | @@ -1085,13 +1085,13 @@ test "open file with exclusive lock twice, make sure second lock waits" { |
| 1085 | var tmp = tmpDir(.{}); | 1085 | var tmp = tmpDir(.{}); |
| 1086 | defer tmp.cleanup(); | 1086 | defer tmp.cleanup(); |
| 1087 | 1087 | ||
| 1088 | const file = try tmp.dir.createFile(filename, .{ .lock = .Exclusive }); | 1088 | const file = try tmp.dir.createFile(filename, .{ .lock = .exclusive }); |
| 1089 | errdefer file.close(); | 1089 | errdefer file.close(); |
| 1090 | 1090 | ||
| 1091 | const S = struct { | 1091 | const S = struct { |
| 1092 | fn checkFn(dir: *fs.Dir, started: *std.Thread.ResetEvent, locked: *std.Thread.ResetEvent) !void { | 1092 | fn checkFn(dir: *fs.Dir, started: *std.Thread.ResetEvent, locked: *std.Thread.ResetEvent) !void { |
| 1093 | started.set(); | 1093 | started.set(); |
| 1094 | const file1 = try dir.createFile(filename, .{ .lock = .Exclusive }); | 1094 | const file1 = try dir.createFile(filename, .{ .lock = .exclusive }); |
| 1095 | 1095 | ||
| 1096 | locked.set(); | 1096 | locked.set(); |
| 1097 | file1.close(); | 1097 | file1.close(); |
| ... | @@ -1138,12 +1138,12 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" { | ... | @@ -1138,12 +1138,12 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" { |
| 1138 | defer gpa.free(filename); | 1138 | defer gpa.free(filename); |
| 1139 | 1139 | ||
| 1140 | const file1 = try fs.createFileAbsolute(filename, .{ | 1140 | const file1 = try fs.createFileAbsolute(filename, .{ |
| 1141 | .lock = .Exclusive, | 1141 | .lock = .exclusive, |
| 1142 | .lock_nonblocking = true, | 1142 | .lock_nonblocking = true, |
| 1143 | }); | 1143 | }); |
| 1144 | 1144 | ||
| 1145 | const file2 = fs.createFileAbsolute(filename, .{ | 1145 | const file2 = fs.createFileAbsolute(filename, .{ |
| 1146 | .lock = .Exclusive, | 1146 | .lock = .exclusive, |
| 1147 | .lock_nonblocking = true, | 1147 | .lock_nonblocking = true, |
| 1148 | }); | 1148 | }); |
| 1149 | file1.close(); | 1149 | file1.close(); |
src/Module.zig+4-4| ... | @@ -3618,7 +3618,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void { | ... | @@ -3618,7 +3618,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void { |
| 3618 | file.sub_file_path, want_local_cache, &digest, | 3618 | file.sub_file_path, want_local_cache, &digest, |
| 3619 | }); | 3619 | }); |
| 3620 | 3620 | ||
| 3621 | break :lock .Shared; | 3621 | break :lock .shared; |
| 3622 | }, | 3622 | }, |
| 3623 | .parse_failure, .astgen_failure, .success_zir => lock: { | 3623 | .parse_failure, .astgen_failure, .success_zir => lock: { |
| 3624 | const unchanged_metadata = | 3624 | const unchanged_metadata = |
| ... | @@ -3633,7 +3633,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void { | ... | @@ -3633,7 +3633,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void { |
| 3633 | 3633 | ||
| 3634 | log.debug("metadata changed: {s}", .{file.sub_file_path}); | 3634 | log.debug("metadata changed: {s}", .{file.sub_file_path}); |
| 3635 | 3635 | ||
| 3636 | break :lock .Exclusive; | 3636 | break :lock .exclusive; |
| 3637 | }, | 3637 | }, |
| 3638 | }; | 3638 | }; |
| 3639 | 3639 | ||
| ... | @@ -3715,11 +3715,11 @@ pub fn astGenFile(mod: *Module, file: *File) !void { | ... | @@ -3715,11 +3715,11 @@ pub fn astGenFile(mod: *Module, file: *File) !void { |
| 3715 | } | 3715 | } |
| 3716 | 3716 | ||
| 3717 | // If we already have the exclusive lock then it is our job to update. | 3717 | // If we already have the exclusive lock then it is our job to update. |
| 3718 | if (builtin.os.tag == .wasi or lock == .Exclusive) break; | 3718 | if (builtin.os.tag == .wasi or lock == .exclusive) break; |
| 3719 | // Otherwise, unlock to give someone a chance to get the exclusive lock | 3719 | // Otherwise, unlock to give someone a chance to get the exclusive lock |
| 3720 | // and then upgrade to an exclusive lock. | 3720 | // and then upgrade to an exclusive lock. |
| 3721 | cache_file.unlock(); | 3721 | cache_file.unlock(); |
| 3722 | lock = .Exclusive; | 3722 | lock = .exclusive; |
| 3723 | try cache_file.lock(lock); | 3723 | try cache_file.lock(lock); |
| 3724 | } | 3724 | } |
| 3725 | 3725 |