fixes for darwin

This commit is contained in:
Andrew Kelley
2019-05-27 14:12:50 -04:00
parent f1610f6c1d
commit 06435535d3
7 changed files with 46 additions and 55 deletions

View File

@@ -323,6 +323,7 @@ pub const Thread = struct {
pub const CpuCountError = error{
OutOfMemory,
PermissionDenied,
SystemResources,
Unexpected,
};
@@ -339,7 +340,7 @@ pub const Thread = struct {
var count: c_int = undefined;
var count_len: usize = @sizeOf(c_int);
const name = if (os.darwin.is_the_target) c"hw.logicalcpu" else c"hw.ncpu";
try os.sysctlbyname(name, @ptrCast(*c_void, &count), &count_len, null, 0);
try os.sysctlbynameC(name, @ptrCast(*c_void, &count), &count_len, null, 0);
return @intCast(usize, count);
}
};