[vlc-commits] commit: Get process affinity mask to compute the number of cpu in vlc_GetCPUCount. (Laurent Aimar )

git at videolan.org git at videolan.org
Sun Nov 7 16:45:26 CET 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Nov  5 21:27:19 2010 +0100| [47d9c75432a372e5a04ea0b63c64346fb238da22] | committer: Laurent Aimar 

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

The old code used the current thread affinity.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=47d9c75432a372e5a04ea0b63c64346fb238da22
---

 src/misc/cpu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/misc/cpu.c b/src/misc/cpu.c
index e630e9b..811298a 100644
--- a/src/misc/cpu.c
+++ b/src/misc/cpu.c
@@ -356,7 +356,7 @@ unsigned vlc_GetCPUCount(void)
 #elif defined(HAVE_SCHED_GETAFFINITY)
     cpu_set_t cpu;
     CPU_ZERO(&cpu);
-    if (sched_getaffinity(0, sizeof(cpu), &cpu) < 0)
+    if (sched_getaffinity(getpid(), sizeof(cpu), &cpu) < 0)
         return 1;
     unsigned count = 0;
     for (unsigned i = 0; i < CPU_SETSIZE; i++)



More information about the vlc-commits mailing list