History

Only use CPU_COUNT if available

Fixes build error on Linux hosts with GLIBC < 2.6. Resolves issue #2089

Nathan Kidd committed 11 years ago

Commit fdabca41 parent fd7a02b1 file · +13 −2Browse files

Showing the changes to codec/common/src/WelsThreadLib.cpp (1 of 1 file). Show all

Unified · Split

codec/common/src/WelsThreadLib.cpp+13−2
@@ -476,10 +476,21 @@ WELS_THREAD_ERROR_CODE WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* p · 475 unmodified lines
476 476
477 CPU_ZERO (&cpuset);477 CPU_ZERO (&cpuset);
478 478
479 if (!sched_getaffinity (0, sizeof (cpuset), &cpuset))479 if (!sched_getaffinity (0, sizeof (cpuset), &cpuset)) {
480#ifdef CPU_COUNT
480 pInfo->ProcessorCount = CPU_COUNT (&cpuset);481 pInfo->ProcessorCount = CPU_COUNT (&cpuset);
481 else482#else
483 int32_t count = 0;
484 for (int i = 0; i < CPU_SETSIZE; i++) {
485 if (CPU_ISSET(i, &cpuset)) {
486 count++;
487 }
488 }
489 pInfo->ProcessorCount = count;
490#endif
491 } else {
482 pInfo->ProcessorCount = 1;492 pInfo->ProcessorCount = 1;
493 }
483 494
484 return WELS_THREAD_ERROR_OK;495 return WELS_THREAD_ERROR_OK;
485 496

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t