authorgravatar for kris.tate+github@gmail.comkristopher tate <kris.tate+github@gmail.com> 2018-08-03 01:59:59+09:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-08-02 12:59:59-04:00
log432b7685bfa840a459b492a37894f7ffed870c7e
tree55d18f9a7c9423541dd0a2555d5269214d303419
parente66f538972d1278ed95513aa1d97c196818a73c6

std/os/index.zig: use "hw.logicalcpu" instead of "hw.ncpu" in macOS; (#1317)

Tracking Issue #1252 ; hw.ncpu was deprecated in macOS. Among 4 new options available (hw.{physicalcpu, physicalcpu_max, logicalcpu, logicalcpu_max}), hw.logicalcpu was chosen because it actually reflects the number of logical cores the OS sees.

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

std/os/index.zig+1-1
......@@ -2790,7 +2790,7 @@ pub fn cpuCount(fallback_allocator: *mem.Allocator) CpuCountError!usize {
27902790 builtin.Os.macosx => {
27912791 var count: c_int = undefined;
27922792 var count_len: usize = @sizeOf(c_int);
2793 const rc = posix.sysctlbyname(c"hw.ncpu", @ptrCast(*c_void, &count), &count_len, null, 0);
2793 const rc = posix.sysctlbyname(c"hw.logicalcpu", @ptrCast(*c_void, &count), &count_len, null, 0);
27942794 const err = posix.getErrno(rc);
27952795 switch (err) {
27962796 0 => return @intCast(usize, count),