[FFmpeg-devel] [PATCH 1/3] libavutil: prefix log messages with thread name

Martin Carroll martin.carroll at alcatel-lucent.com
Fri Jul 27 19:10:01 CEST 2012

Hi Michael,

> a single normal transcoding on a modern desktop might use
> 30+ threads...a few hundread can surely end up existing at
> the same time ...threads can be removed as well...there
> could be millions of threads created and destroyed

Good points.  This topples my "a static table is easier than TLS"
argument.  I will fix.

> maybe i am missing something but why do we want the creating thread
> to set [the thread name]?

Because when thread T0 creates thread T1 with start function f,
only T0 knows that a thread was just created.  The function f
cannot be sure that it is the start of a new thread, because f
could have been called directly from some pre-existing thread.
The only (portable) way for a function f to be sure that its
current invocation is the start of a new thread is for f to have
global knowledge of all programs that might ever call f.

I will submit a new patch.


More information about the ffmpeg-devel mailing list