From 5065830aa007c374c382be9e80ba924df6cecc78 Mon Sep 17 00:00:00 2001 From: Cody Tapscott Date: Thu, 3 Feb 2022 15:27:01 -0700 Subject: Avoid depending on child process execution when not supported by host OS In accordance with the requesting issue (#10750): - `zig test` skips any tests that it cannot spawn, returning success - `zig run` and `zig build` exit with failure, reporting the command the cannot be run - `zig clang`, `zig ar`, etc. already punt directly to the appropriate clang/lld main(), even before this change - Native `libc` Detection is not supported Additionally, `exec()` and related Builder functions error at run-time, reporting the command that cannot be run --- src/ThreadPool.zig | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ThreadPool.zig') diff --git a/src/ThreadPool.zig b/src/ThreadPool.zig index 4f9d8dc015..813d67db66 100644 --- a/src/ThreadPool.zig +++ b/src/ThreadPool.zig @@ -82,6 +82,9 @@ pub fn init(self: *ThreadPool, allocator: std.mem.Allocator) !void { } fn destroyWorkers(self: *ThreadPool, spawned: usize) void { + if (builtin.single_threaded) + return; + for (self.workers[0..spawned]) |*worker| { worker.thread.join(); worker.idle_node.data.deinit(); -- cgit v1.2.3