From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v3] avutil/thread: add wrappers for pthread_cond_t and pthread_t functions
Date: Sat, 19 Aug 2023 13:55:18 +0200
Message-ID: <AS8P250MB07449877846DED05F635C0A58F18A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20230818220314.3991-1-jamrial@gmail.com>
James Almer:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> libavutil/thread.h | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/libavutil/thread.h b/libavutil/thread.h
> index 2f5e7e1cb5..f67b0cdc44 100644
> --- a/libavutil/thread.h
> +++ b/libavutil/thread.h
> @@ -163,11 +163,25 @@ 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
>
> #define ff_thread_once(control, routine) pthread_once(control, routine)
>
> +#define AVThread pthread_t
> +
> +#define ff_thread_create pthread_create
> +#define ff_thread_join pthread_join
> +
> #else
>
> #define AVMutex char
> @@ -178,6 +192,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
>
> @@ -190,6 +214,12 @@ static inline int ff_thread_once(char *control, void (*routine)(void))
> return 0;
> }
>
> +#define AVThread char
> +
> +static inline int ff_thread_create(AVThread *thread, const void *unused_attr,
> + void *(*start_routine)(void*), void *arg){ return 0; }
> +static inline int ff_thread_join(AVThread thread, void **value_ptr){ return 0; }
> +
> #endif
>
> static inline int ff_thread_setname(const char *name)
The commit message should explain what the gain of this is; after all,
we managed to make it without these wrappers until now.
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-08-19 12:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-18 16:06 [FFmpeg-devel] [PATCH] " James Almer
2023-08-18 16:14 ` [FFmpeg-devel] [PATCH v2] " James Almer
2023-08-18 20:16 ` Michael Niedermayer
2023-08-18 22:03 ` [FFmpeg-devel] [PATCH v3] " James Almer
2023-08-19 11:55 ` Andreas Rheinhardt [this message]
2023-08-19 13:06 ` James Almer
2023-08-18 22:04 ` [FFmpeg-devel] [PATCH v2] " James Almer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AS8P250MB07449877846DED05F635C0A58F18A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git