summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-28 19:28:38 +0100
committerwm4 <wm4@nowhere>2013-11-28 19:28:38 +0100
commit0d255f07bf46948289a2698a4a7063514d0e1ef9 (patch)
tree640b11bf0a569aa9292db6e31e697ada2ccdba7f /video
parent0a18f3eb9a163b1cd656129dac6164d7914ecc41 (diff)
downloadmpv-0d255f07bf46948289a2698a4a7063514d0e1ef9.tar.bz2
mpv-0d255f07bf46948289a2698a4a7063514d0e1ef9.tar.xz
build: make pthreads mandatory
pthreads should be available anywhere. Even if not, for environment without threads a pthread wrapper could be provided that can't actually start threads, thus disabling features that require threads. Make pthreads mandatory in order to simplify build dependencies and to reduce ifdeffery. (Admittedly, there wasn't much complexity, but maybe we will use pthreads more in the future, and then it'd become a real bother.)
Diffstat (limited to 'video')
-rw-r--r--video/decode/lavc_dr1.c8
-rw-r--r--video/mp_image.c7
-rw-r--r--video/mp_image_pool.c11
3 files changed, 5 insertions, 21 deletions
diff --git a/video/decode/lavc_dr1.c b/video/decode/lavc_dr1.c
index cf1852b1ab..03e2b5b873 100644
--- a/video/decode/lavc_dr1.c
+++ b/video/decode/lavc_dr1.c
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include <errno.h>
#include <math.h>
-
+#include <pthread.h>
#include <libavcodec/avcodec.h>
#include <libavutil/avassert.h>
@@ -44,15 +44,9 @@
#include "lavc.h"
#include "video/decode/dec_video.h"
-#if HAVE_PTHREADS
-#include <pthread.h>
static pthread_mutex_t pool_mutex = PTHREAD_MUTEX_INITIALIZER;
#define pool_lock() pthread_mutex_lock(&pool_mutex)
#define pool_unlock() pthread_mutex_unlock(&pool_mutex)
-#else
-#define pool_lock() 0
-#define pool_unlock() 0
-#endif
typedef struct FramePool {
struct FrameBuffer *list;
diff --git a/video/mp_image.c b/video/mp_image.c
index 9b96bab67d..242e09e2d0 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <pthread.h>
#include <assert.h>
#include <libavutil/mem.h>
@@ -38,15 +39,9 @@
#include "video/filter/vf.h"
-#if HAVE_PTHREADS
-#include <pthread.h>
static pthread_mutex_t refcount_mutex = PTHREAD_MUTEX_INITIALIZER;
#define refcount_lock() pthread_mutex_lock(&refcount_mutex)
#define refcount_unlock() pthread_mutex_unlock(&refcount_mutex)
-#else
-#define refcount_lock() 0
-#define refcount_unlock() 0
-#endif
struct m_refcount {
void *arg;
diff --git a/video/mp_image_pool.c b/video/mp_image_pool.c
index 1ef08b5e2d..d7f992483e 100644
--- a/video/mp_image_pool.c
+++ b/video/mp_image_pool.c
@@ -20,6 +20,7 @@
#include <stddef.h>
#include <stdbool.h>
+#include <pthread.h>
#include <assert.h>
#include "talloc.h"
@@ -29,19 +30,13 @@
#include "mp_image_pool.h"
-#if HAVE_PTHREADS
-#include <pthread.h>
static pthread_mutex_t pool_mutex = PTHREAD_MUTEX_INITIALIZER;
#define pool_lock() pthread_mutex_lock(&pool_mutex)
#define pool_unlock() pthread_mutex_unlock(&pool_mutex)
-#else
-#define pool_lock() 0
-#define pool_unlock() 0
-#endif
// Thread-safety: the pool itself is not thread-safe, but pool-allocated images
-// can be referenced and unreferenced from other threads. (As long as compiled
-// with pthreads, and the image destructors are thread-safe.)
+// can be referenced and unreferenced from other threads. (As long as the image
+// destructors are thread-safe.)
struct mp_image_pool {
int max_count;