Skip to content

Commit

Permalink
Merge pull request #5789 from giordano/mg/mpl-thread-musl
Browse files Browse the repository at this point in the history
mpl: Use CPU affinity functions with standard names

Approved-by: Ken Raffenetti <[email protected]>
  • Loading branch information
raffenet authored Feb 23, 2022
2 parents a78f64f + 099bb98 commit ebe7e0a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mpl/src/thread/mpl_thread_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ void MPL_thread_set_affinity(MPL_thread_id_t thread, int *affinity_arr, int affi
int err = MPL_SUCCESS;
int proc_idx, set_size = 0;
cpu_set_t cpuset;
__CPU_ZERO_S(sizeof(cpu_set_t), &cpuset);
CPU_ZERO_S(sizeof(cpu_set_t), &cpuset);

for (proc_idx = 0; proc_idx < affinity_size; proc_idx++)
__CPU_SET_S(affinity_arr[proc_idx], sizeof(cpu_set_t), &cpuset);
CPU_SET_S(affinity_arr[proc_idx], sizeof(cpu_set_t), &cpuset);

if (pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset) != 0) {
err = MPL_ERR_THREAD;
Expand All @@ -106,7 +106,7 @@ void MPL_thread_set_affinity(MPL_thread_id_t thread, int *affinity_arr, int affi
}

for (proc_idx = 0; proc_idx < affinity_size; proc_idx++) {
if (__CPU_ISSET_S(affinity_arr[proc_idx], sizeof(cpu_set_t), &cpuset))
if (CPU_ISSET_S(affinity_arr[proc_idx], sizeof(cpu_set_t), &cpuset))
set_size++;
}
if (set_size != affinity_size) {
Expand Down

0 comments on commit ebe7e0a

Please sign in to comment.