On 1/20/2016 5:44 PM, Clément Bœsch wrote: > --- > libavcodec/frame_thread_encoder.c | 2 ++ > libavcodec/pthread_slice.c | 2 ++ > libavfilter/pthread.c | 2 ++ > libavformat/async.c | 2 ++ > libavformat/udp.c | 3 +++ > libavutil/thread.h | 9 +++++++++ > 6 files changed, 20 insertions(+) > > diff --git a/libavcodec/frame_thread_encoder.c > b/libavcodec/frame_thread_encoder.c > index f4d35f9..6c3b048 100644 > --- a/libavcodec/frame_thread_encoder.c > +++ b/libavcodec/frame_thread_encoder.c > @@ -62,6 +62,8 @@ static void * attribute_align_arg worker(void *v){ > ThreadContext *c = avctx->internal->frame_thread_encoder; > AVPacket *pkt = NULL; > > + ff_pthread_setname("ffmpeg frame worker"); > + > while(!c->exit){ > int got_packet, ret; > AVFrame *frame; > diff --git a/libavcodec/pthread_slice.c b/libavcodec/pthread_slice.c > index 3ba5c66..5d26fc7 100644 > --- a/libavcodec/pthread_slice.c > +++ b/libavcodec/pthread_slice.c > @@ -70,6 +70,8 @@ static void* attribute_align_arg worker(void *v) > int thread_count = avctx->thread_count; > int self_id; > > + ff_pthread_setname("ffmpeg slice worker"); > + > pthread_mutex_lock(&c->current_job_lock); > self_id = c->current_job++; > for (;;){ > diff --git a/libavfilter/pthread.c b/libavfilter/pthread.c > index 1c54193..1fbcac9 100644 > --- a/libavfilter/pthread.c > +++ b/libavfilter/pthread.c > @@ -63,6 +63,8 @@ static void* attribute_align_arg worker(void *v) > unsigned int last_execute = 0; > int self_id; > > + ff_pthread_setname("ffmpeg filter worker"); > + > pthread_mutex_lock(&c->current_job_lock); > self_id = c->current_job++; > for (;;) { > diff --git a/libavformat/async.c b/libavformat/async.c > index 4308c4b..4232f79 100644 > --- a/libavformat/async.c > +++ b/libavformat/async.c > @@ -181,6 +181,8 @@ static void *async_buffer_task(void *arg) > int ret = 0; > int64_t seek_ret; > > + ff_pthread_setname("ffmpeg async buffer task"); > + > while (1) { > int fifo_space, to_copy; > > diff --git a/libavformat/udp.c b/libavformat/udp.c > index ea80e52..b52987e 100644 > --- a/libavformat/udp.c > +++ b/libavformat/udp.c > @@ -35,6 +35,7 @@ > #include "libavutil/avstring.h" > #include "libavutil/opt.h" > #include "libavutil/log.h" > +#include "libavutil/thread.h" > #include "libavutil/time.h" > #include "internal.h" > #include "network.h" > @@ -492,6 +493,8 @@ static void *circular_buffer_task( void *_URLContext) > UDPContext *s = h->priv_data; > int old_cancelstate; > > + ff_pthread_setname("ffmpeg UDP circular buffer task"); > + > pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_cancelstate); > pthread_mutex_lock(&s->mutex); > if (ff_socket_nonblock(s->udp_fd, 0) < 0) { > diff --git a/libavutil/thread.h b/libavutil/thread.h > index 32ddf40..a7b5763 100644 > --- a/libavutil/thread.h > +++ b/libavutil/thread.h > @@ -169,4 +169,13 @@ static inline int ff_thread_once(char *control, void > (*routine)(void)) > > #endif > > +static inline void ff_pthread_setname(const char *name)
ff_thread_setname(). lavu/thread.h is supposed to be implementation independent. And you're placing this outside the "HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS" check. Move it there, after the header includes. In the #else (no threading support) you should add "#define ff_thread_setname(name) (0)" instead. Ideally, however, would be to add a pthread_setname() to both compat headers (w32 and os2) even if they lack an implementation for the time being, place this function inside the HAVE_PTHREADS check, then #define ff_thread_setname to pthread_setname or (0), like we do for every other function. > +{ > +#if defined(__APPLE__) > + pthread_setname_np(name); > +#elif defined(__linux__) > + pthread_setname_np(pthread_self(), name); > +#endif > +} > + > #endif /* AVUTIL_THREAD_H */ > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel