fixed an unused warning

This commit is contained in:
Guenter Obiltschnig
2015-04-23 16:08:16 +02:00
parent ac12cd4972
commit 1f1f828e29

View File

@@ -225,7 +225,6 @@ void ThreadImpl::setAffinityImpl(int cpu)
int ThreadImpl::getAffinityImpl() const int ThreadImpl::getAffinityImpl() const
{ {
int cpuSet = -1; int cpuSet = -1;
int cpuCount = Environment::processorCount();
#if defined (POCO_OS_FAMILY_UNIX) && POCO_OS != POCO_OS_MAC_OS_X #if defined (POCO_OS_FAMILY_UNIX) && POCO_OS != POCO_OS_MAC_OS_X
#ifdef HAVE_PTHREAD_SETAFFINITY_NP #ifdef HAVE_PTHREAD_SETAFFINITY_NP
cpu_set_t cpuset; cpu_set_t cpuset;
@@ -237,6 +236,7 @@ int ThreadImpl::getAffinityImpl() const
if (pthread_getaffinity_np(_pData->thread, &cpuset) != 0) if (pthread_getaffinity_np(_pData->thread, &cpuset) != 0)
throw SystemException("Failed to get affinity", errno); throw SystemException("Failed to get affinity", errno);
#endif #endif
int cpuCount = Environment::processorCount();
for (int i = 0; i < cpuCount; i++) for (int i = 0; i < cpuCount; i++)
{ {
if (CPU_ISSET(i, &cpuset)) if (CPU_ISSET(i, &cpuset))
@@ -263,6 +263,7 @@ int ThreadImpl::getAffinityImpl() const
throw SystemException("Failed to get affinity", errno); throw SystemException("Failed to get affinity", errno);
} }
cpuSet = policy.affinity_tag; cpuSet = policy.affinity_tag;
int cpuCount = Environment::processorCount();
if (cpuSet >= cpuCount) if (cpuSet >= cpuCount)
cpuSet = -1; cpuSet = -1;