[vlc-commits] commit: cpu: Implement vlc_GetCPUCount() on Mac OS X. (Pierre d'Herbemont )
git at videolan.org
git at videolan.org
Tue May 4 22:48:25 CEST 2010
vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Tue May 4 20:50:37 2010 +0200| [3953586c057cb4cbecb2c5d5aa7631ec17e40d1f] | committer: Pierre d'Herbemont
cpu: Implement vlc_GetCPUCount() on Mac OS X.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3953586c057cb4cbecb2c5d5aa7631ec17e40d1f
---
src/misc/cpu.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/misc/cpu.c b/src/misc/cpu.c
index cc350ec..5a6830b 100644
--- a/src/misc/cpu.c
+++ b/src/misc/cpu.c
@@ -344,6 +344,12 @@ unsigned vlc_GetCPUCount(void)
for (unsigned i = 0; i < CPU_SETSIZE; i++)
count += CPU_ISSET(i, &cpu) != 0;
return count;
+#elif defined(__APPLE_)
+ int count;
+ size_t size = sizeof(count) ;
+ if (sysctlbyname("hw.ncpu", &count, &size, NULL, 0))
+ return 1; /* Failure */
+ return count;
#else
# warning "vlc_GetCPUCount is not implemented for your platform"
return 1;
More information about the vlc-commits
mailing list