mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Compilation: revert asking for exclusive locks on cache hits
We definitely want a shared lock on a cache hit. Without this, we get a
deadlock when Zig is asked to compile the same C source file multiple
times as part of the same compilation.
This is a partial revert of 8ccb9a6ad3.
cc @kcbanner
This commit is contained in:
parent
a4418a8fd6
commit
07f6fc3000
1 changed files with 0 additions and 4 deletions
|
|
@ -3580,7 +3580,6 @@ pub fn cImport(comp: *Compilation, c_src: []const u8) !CImportResult {
|
|||
const cimport_zig_basename = "cimport.zig";
|
||||
|
||||
var man = comp.obtainCObjectCacheManifest();
|
||||
man.want_shared_lock = false;
|
||||
defer man.deinit();
|
||||
|
||||
const use_stage1 = build_options.have_stage1 and comp.bin_file.options.use_stage1;
|
||||
|
|
@ -3698,7 +3697,6 @@ pub fn cImport(comp: *Compilation, c_src: []const u8) !CImportResult {
|
|||
// possible we had a hit and the manifest is dirty, for example if the file mtime changed but
|
||||
// the contents were the same, we hit the cache but the manifest is dirty and we need to update
|
||||
// it to prevent doing a full file content comparison the next time around.
|
||||
man.want_shared_lock = true;
|
||||
man.writeManifest() catch |err| {
|
||||
log.warn("failed to write cache manifest for C import: {s}", .{@errorName(err)});
|
||||
};
|
||||
|
|
@ -3873,7 +3871,6 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P
|
|||
}
|
||||
|
||||
var man = comp.obtainCObjectCacheManifest();
|
||||
man.want_shared_lock = false;
|
||||
defer man.deinit();
|
||||
|
||||
man.hash.add(comp.clang_preprocessor_mode);
|
||||
|
|
@ -4167,7 +4164,6 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P
|
|||
// possible we had a hit and the manifest is dirty, for example if the file mtime changed but
|
||||
// the contents were the same, we hit the cache but the manifest is dirty and we need to update
|
||||
// it to prevent doing a full file content comparison the next time around.
|
||||
man.want_shared_lock = true;
|
||||
man.writeManifest() catch |err| {
|
||||
log.warn("failed to write cache manifest when compiling '{s}': {s}", .{ c_object.src.src_path, @errorName(err) });
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue