[FFmpeg-devel] [PATCH] lavu: add ff_pthread_setname() and use it in various places

James Almer jamrial at gmail.com
Thu Jan 21 01:15:15 CET 2016


On 1/20/2016 7:46 PM, Clément Bœsch wrote:
> diff --git a/libavutil/thread.h b/libavutil/thread.h
> index 32ddf40..42430fb 100644
> --- a/libavutil/thread.h
> +++ b/libavutil/thread.h
> @@ -31,6 +31,15 @@
>  #if HAVE_PTHREADS
>  #include <pthread.h>
>  
> +static inline void ff_thread_setname(const char *name)
> +{
> +#if defined(__APPLE__)
> +    pthread_setname_np(name);
> +#elif defined(__linux__) && defined(__GLIBC__)
> +    pthread_setname_np(pthread_self(), name);
> +#endif
> +}
> +
>  #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
>  
>  #include "log.h"
> @@ -143,6 +152,7 @@ static inline int strict_pthread_once(pthread_once_t *once_control, void (*init_
>  #define AV_ONCE_INIT PTHREAD_ONCE_INIT
>  
>  #define ff_thread_once(control, routine) pthread_once(control, routine)
> +#define ff_thread_setname(name) (0)

This is also being applied to pthreads.


More information about the ffmpeg-devel mailing list