I\'m trying to set core affinity (Thread #1 goes on first core, Thread #2 goes on second core, ...) while using std::thread in C++ 11.
I\'ve already searched around vari
I do not know if it is a suitable approach in your case, but what I usually do is to call the affinity primitives from within the thread. E.g., I place a snippet of code similar to this one somewhere at the beginning of the threaded function:
const int err = pthread_setaffinity_np(pthread_self(),...);
The call to pthread_self()
will return the ID of the calling thread.