[FFmpeg-devel] [PATCH] lazily create threads in pthread.c

Michael Niedermayer michaelni
Mon Aug 13 00:50:02 CEST 2007


Hi

On Sun, Aug 12, 2007 at 02:33:31PM -0400, Alexander Strange wrote:
> 
> On Aug 12, 2007, at 2:04 PM, Reimar D?ffinger wrote:
> 
> > Hello,
> > On Sun, Aug 12, 2007 at 01:47:25PM -0400, Alexander Strange wrote:
> >> This patch changes pthread.c so that threads aren't created until  
> >> execute()
> >> requests them.
> >> This way, you can unconditionally call avcodec_thread_init() and  
> >> not have
> >> unused threads lying around if they aren't used.
> >
> > You forgot to say what the advantage is supposed to be...
> >
> >> It could also save one worker thread by reusing the main thread,  
> >> instead of
> >> sleeping it; I'll probably look at that later.
> >
> > Again, advantage? I think any halfway recent OS is designed to easily
> > handle hundreds of threads, I can't imagine ffmpeg using e.g. 4  
> > instead of 5
> > threads will gain much if anything.
> 
> Pretty much cosmetic. A few more sleeping threads won't confuse any  
> decent OS,
> they just clutter up gdb or profilers. And ps output, for those  
> pthread systems that fork for every thread.
> 
> I don't see any stability or performance changes introduced by this,  
> so it should be harmless otherwise.

it complicates the code (and more complex code, more bugs ...)

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070813/0d6a786c/attachment.pgp>



More information about the ffmpeg-devel mailing list