authorgravatar for kbutcher6200@gmail.comkprotty <kbutcher6200@gmail.com> 2021-06-19 21:50:34-05:00
committergravatar for kbutcher6200@gmail.comkprotty <kbutcher6200@gmail.com> 2021-06-30 21:48:59-05:00
log3a276be1355fe304c177bcc13a7896122801e5f2
treebe3cb9210d4cb152403ca031f4565ed973fe086b
parent0a1def7833882249563358f262e2210beb77492a

std.Thread.getCpuCount(): fix usages


3 files changed, 4 insertions(+), 4 deletions(-)

lib/std/event/loop.zig+2-2
......@@ -137,7 +137,7 @@ pub const Loop = struct {
137137 }
138138
139139 /// After initialization, call run().
140 /// This is the same as `initThreadPool` using `Thread.cpuCount` to determine the thread
140 /// This is the same as `initThreadPool` using `Thread.getCpuCount` to determine the thread
141141 /// pool size.
142142 /// TODO copy elision / named return values so that the threads referencing *Loop
143143 /// have the correct pointer value.
......@@ -145,7 +145,7 @@ pub const Loop = struct {
145145 pub fn initMultiThreaded(self: *Loop) !void {
146146 if (builtin.single_threaded)
147147 @compileError("initMultiThreaded unavailable when building in single-threaded mode");
148 const core_count = try Thread.cpuCount();
148 const core_count = try Thread.getCpuCount();
149149 return self.initThreadPool(core_count);
150150 }
151151
lib/std/os/test.zig+1-1
......@@ -364,7 +364,7 @@ fn start2(ctx: *i32) u8 {
364364test "cpu count" {
365365 if (native_os == .wasi) return error.SkipZigTest;
366366
367 const cpu_count = try Thread.cpuCount();
367 const cpu_count = try Thread.getCpuCount();
368368 try expect(cpu_count >= 1);
369369}
370370
src/ThreadPool.zig+1-1
......@@ -60,7 +60,7 @@ pub fn init(self: *ThreadPool, allocator: *std.mem.Allocator) !void {
6060 if (std.builtin.single_threaded)
6161 return;
6262
63 const worker_count = std.math.max(1, std.Thread.cpuCount() catch 1);
63 const worker_count = std.math.max(1, std.Thread.getCpuCount() catch 1);
6464 self.workers = try allocator.alloc(Worker, worker_count);
6565 errdefer allocator.free(self.workers);
6666