Don't try to set CPU affinity if running inside Valgrind

metadata
Wenzel Jakob 2013-11-14 15:37:49 +01:00
parent b308e2cfb7
commit 38fced0f53
1 changed files with 4 additions and 0 deletions

View File

@ -315,6 +315,10 @@ void Thread::setCoreAffinity(int coreID) {
#if defined(__OSX__)
/* CPU affinity not supported on OSX */
#elif defined(__LINUX__)
/* Don't try to set CPU affinity if running inside Valgrind */
if (getenv("VALGRIND_OPTS") != NULL)
return;
int nCores = getCoreCount();
cpu_set_t *cpuset = CPU_ALLOC(nCores);
if (cpuset == NULL)