authorgravatar for timonkruiper@gmail.comTimon Kruiper <timonkruiper@gmail.com> 2020-11-09 21:17:57+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-09 20:16:26-07:00
log97692cb4fefcfe54564fdea0e70b656aec5e6f77
treec8d9c0e00082bea17f44b4eb04bd2f9baffb686e
parentd9c808e3ff5dc6f72d92457ac448b427d1ce66ff

Do not keep the build.zig cache manifest file locked.

This allows to have multiple instances of `zig build` at the same time. For example when you have a long running `zig build run` and then want to run `zig build somethingelse`.

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

src/main.zig+2-9
...@@ -2208,7 +2208,7 @@ pub const usage_build =...@@ -2208,7 +2208,7 @@ pub const usage_build =
2208pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !void {2208pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !void {
2209 // We want to release all the locks before executing the child process, so we make a nice2209 // We want to release all the locks before executing the child process, so we make a nice
2210 // big block here to ensure the cleanup gets run when we extract out our argv.2210 // big block here to ensure the cleanup gets run when we extract out our argv.
2211 const lock_and_argv = lock_and_argv: {2211 const child_argv = argv: {
2212 const self_exe_path = try fs.selfExePathAlloc(arena);2212 const self_exe_path = try fs.selfExePathAlloc(arena);
22132213
2214 var build_file: ?[]const u8 = null;2214 var build_file: ?[]const u8 = null;
...@@ -2403,15 +2403,8 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v...@@ -2403,15 +2403,8 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
2403 &[_][]const u8{exe_basename},2403 &[_][]const u8{exe_basename},
2404 );2404 );
24052405
2406 break :lock_and_argv .{2406 break :argv child_argv.items;
2407 .child_argv = child_argv.items,
2408 .lock = comp.bin_file.toOwnedLock(),
2409 };
2410 };2407 };
2411 const child_argv = lock_and_argv.child_argv;
2412 var lock = lock_and_argv.lock;
2413 defer lock.release();
2414
2415 const child = try std.ChildProcess.init(child_argv, gpa);2408 const child = try std.ChildProcess.init(child_argv, gpa);
2416 defer child.deinit();2409 defer child.deinit();
24172410