diff --git a/regressions/common.h b/regressions/common.h index 399b706..c8ae4cd 100644 --- a/regressions/common.h +++ b/regressions/common.h @@ -32,6 +32,9 @@ #include #include #include +#elif defined(__MACH__) +#include +#include #endif #ifndef CORES @@ -66,6 +69,20 @@ aff_iterate(struct affinity *acb) return sched_setaffinity(gettid(), sizeof(s), &s); } +#elif defined(__MACH__) +CK_CC_UNUSED static int +aff_iterate(struct affinity *acb) +{ + thread_affinity_policy_data_t policy; + unsigned int c; + + c = ck_pr_faa_uint(&acb->request, acb->delta) % CORES; + policy.affinity_tag = c; + return thread_policy_set(mach_thread_self(), + THREAD_AFFINITY_POLICY, + (thread_policy_t)&policy, + THREAD_AFFINITY_POLICY_COUNT); +} #else CK_CC_UNUSED static int aff_iterate(struct affinity *acb CK_CC_UNUSED)