Only use CPU_COUNT if available
Fixes build error on Linux hosts with GLIBC < 2.6. Resolves issue #2089
This commit is contained in:
parent
fd7a02b557
commit
fdabca4cc9
@ -476,10 +476,21 @@ WELS_THREAD_ERROR_CODE WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* p
|
||||
|
||||
CPU_ZERO (&cpuset);
|
||||
|
||||
if (!sched_getaffinity (0, sizeof (cpuset), &cpuset))
|
||||
if (!sched_getaffinity (0, sizeof (cpuset), &cpuset)) {
|
||||
#ifdef CPU_COUNT
|
||||
pInfo->ProcessorCount = CPU_COUNT (&cpuset);
|
||||
else
|
||||
#else
|
||||
int32_t count = 0;
|
||||
for (int i = 0; i < CPU_SETSIZE; i++) {
|
||||
if (CPU_ISSET(i, &cpuset)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
pInfo->ProcessorCount = count;
|
||||
#endif
|
||||
} else {
|
||||
pInfo->ProcessorCount = 1;
|
||||
}
|
||||
|
||||
return WELS_THREAD_ERROR_OK;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user