45#if defined(__APPLE__) || defined(AS_ALPINE)
48#elif defined(__FreeBSD__)
51 CPU_SET(cpu_id, &cpuset);
52 return pthread_attr_setaffinity_np(attr,
sizeof(cpuset_t), &cpuset);
56 CPU_SET(cpu_id, &cpuset);
57 return pthread_attr_setaffinity_np(attr,
sizeof(cpu_set_t), &cpuset);
68 thread_affinity_policy_data_t policy = {cpu_id};
69 thread_port_t mach_thread = pthread_mach_thread_np(thread);
70 return thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, (thread_policy_t)&policy, 1);
71#elif defined(AS_ALPINE)
74 CPU_SET(cpu_id, &cpuset);
75 return pthread_setaffinity_np(thread,
sizeof(cpu_set_t), &cpuset);