我正在尝试更改启动例程中每个线程的亲和力。
这是代码。在下面的代码中,'t' 是通过 pthread_create 函数传递的参数。
cpu_set_t mask;
pthread_t c;
a = *((int *)t);
printf(" thread no. is %d \n",a);
CPU_ZERO(&mask);
a =a/2 + 1;
CPU_SET(a,&mask);
c=pthread_self();
s=pthread_setaffinity_np(c,sizeof(cpu_set_t), &mask);
if (s!=0)
handle_error_en(s,"pthread_setaffinity_np");
线程关联性没有改变。我哪里错了?