1

I tried using -D_GNU_SOURCE when compiling but neither works, I am trying to use pthread_setaffinity_np and other mutithreading features but the compiler says it is out of scope. This is what I have:

#define _GNU_SOURCE
#include <sched.h>
int cpuAff(){ //set processor affinity
    cpu_set_t cpuset;
    CPU_ZERO(&cpuset);
    CPU_SET(0, &cpuset);
    pthread_setaffinity_np(threads[0], sizeof(cpu_set_t), &cpuset);
    pthread_setaffinity_np(threads[1], sizeof(cpu_set_t), &cpuset);
    pthread_setaffinity_np(threads[2], sizeof(cpu_set_t), &cpuset);
    pthread_setaffinity_np(threads[3], sizeof(cpu_set_t), &cpuset);
}

I am using cygwin on windows 10 if that is the problem? any body know a fix?

Y. Yami
  • 11
  • 1

0 Answers0