From: Pierre d'Herbemont Date: Tue, 4 May 2010 18:50:37 +0000 (+0200) Subject: cpu: Implement vlc_GetCPUCount() on Mac OS X. X-Git-Tag: 1.2.0-pre1~6761 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=3953586c057cb4cbecb2c5d5aa7631ec17e40d1f;p=vlc cpu: Implement vlc_GetCPUCount() on Mac OS X. --- diff --git a/src/misc/cpu.c b/src/misc/cpu.c index cc350ec7ad..5a6830b239 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;