mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
std.c: adding cpu affinity api for macOs (mainly x86_64)
This commit is contained in:
parent
d70853ba39
commit
4bfd37ddb4
@ -3896,3 +3896,23 @@ pub const MIN = struct {
|
||||
|
||||
pub extern "c" fn mincore(addr: *align(std.mem.page_size) const anyopaque, length: usize, vec: [*]u8) c_int;
|
||||
pub extern "c" fn os_proc_available_memory() usize;
|
||||
|
||||
pub const thread_affinity_policy = extern struct {
|
||||
tag: integer_t,
|
||||
};
|
||||
|
||||
pub const thread_policy_flavor_t = natural_t;
|
||||
pub const thread_policy_t = [*]integer_t;
|
||||
pub const thread_affinity_policy_data_t = thread_affinity_policy;
|
||||
pub const thread_affinity_policy_t = [*]thread_affinity_policy;
|
||||
|
||||
pub const THREAD_AFFINITY = struct {
|
||||
pub const POLICY = 0;
|
||||
pub const POLICY_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(thread_affinity_policy_data_t) / @sizeOf(integer_t));
|
||||
};
|
||||
|
||||
/// cpu affinity api
|
||||
/// albeit it is also available on arm64, it always fails as in this architecture there is no sense of
|
||||
/// individual cpus (high performance cpus group and low consumption one), thus the pthread QOS api is more appropriate in this case.
|
||||
pub extern "c" fn thread_affinity_get(thread: thread_act_t, flavor: thread_policy_flavor_t, info: thread_policy_t, infocnt: [*]mach_msg_type_number_t, default: *boolean_t) kern_return_t;
|
||||
pub extern "c" fn thread_affinity_set(thread: thread_act_t, flavor: thread_policy_flavor_t, info: thread_policy_t, infocnt: mach_msg_type_number_t) kern_return_t;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user