Commit 47d9c754 authored by Laurent Aimar's avatar Laurent Aimar

Get process affinity mask to compute the number of cpu in vlc_GetCPUCount.

The old code used the current thread affinity.
parent 7a15e9a7
...@@ -356,7 +356,7 @@ unsigned vlc_GetCPUCount(void) ...@@ -356,7 +356,7 @@ unsigned vlc_GetCPUCount(void)
#elif defined(HAVE_SCHED_GETAFFINITY) #elif defined(HAVE_SCHED_GETAFFINITY)
cpu_set_t cpu; cpu_set_t cpu;
CPU_ZERO(&cpu); CPU_ZERO(&cpu);
if (sched_getaffinity(0, sizeof(cpu), &cpu) < 0) if (sched_getaffinity(getpid(), sizeof(cpu), &cpu) < 0)
return 1; return 1;
unsigned count = 0; unsigned count = 0;
for (unsigned i = 0; i < CPU_SETSIZE; i++) for (unsigned i = 0; i < CPU_SETSIZE; i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment