From 7052618c7ed6e907434b2b6ef18e77b9d2644676 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Fri, 23 Dec 2011 11:10:37 +0100 Subject: [PATCH] threads: check defines before using them in automatic thread detection --- libavcodec/pthread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 89141504f8..f842edf861 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -152,7 +152,7 @@ typedef struct FrameThreadContext { static int get_logical_cpus(AVCodecContext *avctx) { int ret, nb_cpus = 1; -#if HAVE_SCHED_GETAFFINITY +#if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT) cpu_set_t cpuset; CPU_ZERO(&cpuset); @@ -165,7 +165,7 @@ static int get_logical_cpus(AVCodecContext *avctx) SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); nb_cpus = sysinfo.dwNumberOfProcessors; -#elif HAVE_SYSCTL +#elif HAVE_SYSCTL && defined(HW_NCPU) int mib[2] = { CTL_HW, HW_NCPU }; size_t len = sizeof(nb_cpus); -- 2.11.0