aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-28 00:36:23 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-28 00:36:23 +0100
commit15fd62110fd82f19f9e127cf8401756231112ce0 (patch)
tree71caf8465eae6c442237c73ecc8f5bec3d44b177
parent86b532898d8a2dbd9ddd303434bd8a5a395b15a7 (diff)
parent46a17d886b8559723c40b9f5cdf0e0c6b1c95180 (diff)
downloadffmpeg-15fd62110fd82f19f9e127cf8401756231112ce0.tar.gz
Merge commit '46a17d886b8559723c40b9f5cdf0e0c6b1c95180' into release/2.4
* commit '46a17d886b8559723c40b9f5cdf0e0c6b1c95180': lavu: add wrappers for the pthreads mutex API Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavutil/thread.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/libavutil/thread.h b/libavutil/thread.h
new file mode 100644
index 0000000000..62e1340ceb
--- /dev/null
+++ b/libavutil/thread.h
@@ -0,0 +1,53 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+// This header should only be used to simplify code where
+// threading is optional, not as a generic threading abstraction.
+
+#ifndef AVUTIL_THREAD_H
+#define AVUTIL_THREAD_H
+
+#include "config.h"
+
+#if HAVE_PTHREADS || HAVE_W32THREADS
+
+#if HAVE_PTHREADS
+#include <pthread.h>
+#else
+#include <compat/w32pthreads.h>
+#endif
+
+#define AVMutex pthread_mutex_t
+
+#define ff_mutex_init pthread_mutex_init
+#define ff_mutex_lock pthread_mutex_lock
+#define ff_mutex_unlock pthread_mutex_unlock
+#define ff_mutex_destroy pthread_mutex_destroy
+
+#else
+
+#define AVMutex char
+
+#define ff_mutex_init(mutex, attr) (0)
+#define ff_mutex_lock(mutex) (0)
+#define ff_mutex_unlock(mutex) (0)
+#define ff_mutex_destroy(mutex) (0)
+
+#endif
+
+#endif /* AVUTIL_THREAD_H */