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

Michael Niedermayer michael at niedermayer.cc
Sun Jan 24 22:09:49 CET 2016


On Sun, Jan 24, 2016 at 01:58:29PM +0100, Clément Bœsch wrote:
> On Wed, Jan 20, 2016 at 09:15:15PM -0300, James Almer wrote:
> > 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.
> 
> Damn, it's not a good excuse but I was tired and in a hurry that day.
> Thanks for your patience, new patch attached.
> 
> -- 
> Clément B.

>  libavcodec/frame_thread_encoder.c |    2 ++
>  libavcodec/pthread_frame.c        |    2 ++
>  libavcodec/pthread_slice.c        |    2 ++
>  libavfilter/pthread.c             |    2 ++
>  libavformat/async.c               |    2 ++
>  libavformat/udp.c                 |    3 +++
>  libavutil/thread.h                |   13 +++++++++++++

fails to build:
make distclean ; ../configure  --enable-pthreads  --arch=x86_32 --target-os=linux --extra-cflags=-m32 --extra-ldflags=-m32  --enable-cross-compile && make -j12
In file included from libavfilter/pthread.c:30:0:
ffmpeg/libavutil/thread.h: In function ‘ff_thread_setname’:
ffmpeg/libavutil/thread.h:134:5: error: implicit declaration of function ‘pthread_setname_np’ [-Werror=implicit-function-declaration]

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160124/8bb86ea3/attachment.sig>


More information about the ffmpeg-devel mailing list