From Donn Mielcarek, "I'm surprised this hasn't come up before, but the function Thread::setProcessorAffinity

always returns -1, even if the call is successful.  I added return
statements to each of the function calls."
This commit is contained in:
Robert Osfield 2009-11-19 17:18:22 +00:00
parent 258d702d02
commit fcb94de7ed

View File

@ -542,11 +542,11 @@ int Thread::setProcessorAffinity(unsigned int cpunum)
CPU_ZERO( &cpumask );
CPU_SET( pd->cpunum, &cpumask );
#if defined(HAVE_PTHREAD_SETAFFINITY_NP)
pthread_setaffinity_np (pthread_self(), sizeof(cpumask), &cpumask);
return pthread_setaffinity_np (pthread_self(), sizeof(cpumask), &cpumask);
#elif defined(HAVE_THREE_PARAM_SCHED_SETAFFINITY)
sched_setaffinity( 0, sizeof(cpumask), &cpumask );
return sched_setaffinity( 0, sizeof(cpumask), &cpumask );
#elif defined(HAVE_TWO_PARAM_SCHED_SETAFFINITY)
sched_setaffinity( 0, &cpumask );
return sched_setaffinity( 0, &cpumask );
#endif
}