From 8c789c5da3ce9dd721fb0ec14927c3809eca446d Mon Sep 17 00:00:00 2001 From: James Almer Date: Fri, 18 Aug 2023 13:02:19 -0300 Subject: [PATCH] avutil/thread: add wrappers for pthread_cond_t functions This abstraction is similar to the existing one for pthread_mutex_t and pthread_once_t functions, and should reduce the amount of ifdeffery used in future code. Signed-off-by: James Almer --- libavutil/thread.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libavutil/thread.h b/libavutil/thread.h index 2f5e7e1cb5..2ded498c89 100644 --- a/libavutil/thread.h +++ b/libavutil/thread.h @@ -163,6 +163,15 @@ static inline int strict_pthread_once(pthread_once_t *once_control, void (*init_ #define ff_mutex_unlock pthread_mutex_unlock #define ff_mutex_destroy pthread_mutex_destroy +#define AVCond pthread_cond_t + +#define ff_cond_init pthread_cond_init +#define ff_cond_destroy pthread_cond_destroy +#define ff_cond_signal pthread_cond_signal +#define ff_cond_broadcast pthread_cond_broadcast +#define ff_cond_wait pthread_cond_wait +#define ff_cond_timedwait pthread_cond_timedwait + #define AVOnce pthread_once_t #define AV_ONCE_INIT PTHREAD_ONCE_INIT @@ -178,6 +187,16 @@ static inline int ff_mutex_lock(AVMutex *mutex){ return 0; } static inline int ff_mutex_unlock(AVMutex *mutex){ return 0; } static inline int ff_mutex_destroy(AVMutex *mutex){ return 0; } +#define AVCond char + +static inline int ff_cond_init(AVCond *cond, const void *attr){ return 0; } +static inline int ff_cond_destroy(AVCond *cond){ return 0; } +static inline int ff_cond_signal(AVCond *cond){ return 0; } +static inline int ff_cond_broadcast(AVCond *cond){ return 0; } +static inline int ff_cond_wait(AVCond *cond, AVMutex *mutex){ return 0; } +static inline int ff_cond_timedwait(AVCond *cond, AVMutex *mutex, + const void *abstime){ return 0; } + #define AVOnce char #define AV_ONCE_INIT 0