summaryrefslogtreecommitdiff
path: root/libavcodec/pthread.c
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2011-12-23 11:10:37 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-23 16:08:39 +0100
commit5c33a9a5c138324e9405bf680b950cfb7f02f3ee (patch)
tree44e0d6456e7b1e671025fdde3d1a91a763bf8410 /libavcodec/pthread.c
parent8d4668cc5f6c9147ed5bae978c7100fbbdf306a6 (diff)
threads: check defines before using them in automatic thread detection
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pthread.c')
-rw-r--r--libavcodec/pthread.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index eb3e7d40b8..653fb0f200 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -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);