---
 libavutil/thread.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/libavutil/thread.h b/libavutil/thread.h
index 3556544..534085b 100644
--- a/libavutil/thread.h
+++ b/libavutil/thread.h
@@ -39,6 +39,11 @@
 #define ff_mutex_unlock  pthread_mutex_unlock
 #define ff_mutex_destroy pthread_mutex_destroy
 
+#define AVOnce pthread_once_t
+#define AV_ONCE_INIT PTHREAD_ONCE_INIT
+
+#define ff_thread_once(control, routine) pthread_once(control, routine)
+
 #else
 
 #define AVMutex char
@@ -48,6 +53,18 @@
 #define ff_mutex_unlock(mutex) (0)
 #define ff_mutex_destroy(mutex) (0)
 
+#define AVOnce char
+#define AV_ONCE_INIT 0
+
+static inline int ff_thread_once(char *control, void (*routine)(void))
+{
+    if (!control) {
+        routine();
+        control = 1;
+    }
+    return 0;
+}
+
 #endif
 
 #endif /* AVUTIL_THREAD_H */
-- 
2.5.0

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to