@@ -3681,13 +3681,15 @@ pub fn cImport(comp: *Compilation, c_src: []const u8) !CImportResult {
3681
3681
break :digest digest ;
3682
3682
} else man .final ();
3683
3683
3684
- // Write the updated manifest. This is a no-op if the manifest is not dirty. Note that it is
3685
- // possible we had a hit and the manifest is dirty, for example if the file mtime changed but
3686
- // the contents were the same, we hit the cache but the manifest is dirty and we need to update
3687
- // it to prevent doing a full file content comparison the next time around.
3688
- man .writeManifest () catch | err | {
3689
- log .warn ("failed to write cache manifest for C import: {s}" , .{@errorName (err )});
3690
- };
3684
+ if (man .have_exclusive_lock ) {
3685
+ // Write the updated manifest. This is a no-op if the manifest is not dirty. Note that it is
3686
+ // possible we had a hit and the manifest is dirty, for example if the file mtime changed but
3687
+ // the contents were the same, we hit the cache but the manifest is dirty and we need to update
3688
+ // it to prevent doing a full file content comparison the next time around.
3689
+ man .writeManifest () catch | err | {
3690
+ log .warn ("failed to write cache manifest for C import: {s}" , .{@errorName (err )});
3691
+ };
3692
+ }
3691
3693
3692
3694
const out_zig_path = try comp .local_cache_directory .join (comp .gpa , &[_ ][]const u8 {
3693
3695
"o" , & digest , cimport_zig_basename ,
@@ -4086,13 +4088,15 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P
4086
4088
break :blk digest ;
4087
4089
};
4088
4090
4089
- // Write the updated manifest. This is a no-op if the manifest is not dirty. Note that it is
4090
- // possible we had a hit and the manifest is dirty, for example if the file mtime changed but
4091
- // the contents were the same, we hit the cache but the manifest is dirty and we need to update
4092
- // it to prevent doing a full file content comparison the next time around.
4093
- man .writeManifest () catch | err | {
4094
- log .warn ("failed to write cache manifest when compiling '{s}': {s}" , .{ c_object .src .src_path , @errorName (err ) });
4095
- };
4091
+ if (man .have_exclusive_lock ) {
4092
+ // Write the updated manifest. This is a no-op if the manifest is not dirty. Note that it is
4093
+ // possible we had a hit and the manifest is dirty, for example if the file mtime changed but
4094
+ // the contents were the same, we hit the cache but the manifest is dirty and we need to update
4095
+ // it to prevent doing a full file content comparison the next time around.
4096
+ man .writeManifest () catch | err | {
4097
+ log .warn ("failed to write cache manifest when compiling '{s}': {s}" , .{ c_object .src .src_path , @errorName (err ) });
4098
+ };
4099
+ }
4096
4100
4097
4101
const o_basename = try std .fmt .allocPrint (arena , "{s}{s}" , .{ o_basename_noext , o_ext });
4098
4102
0 commit comments