threads: check defines before using them in automatic thread detection

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Janne Grunau 2011-12-23 11:10:37 +01:00 committed by Michael Niedermayer
parent 8d4668cc5f
commit 5c33a9a5c1

View File

@ -154,7 +154,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);
@ -167,7 +167,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);