On Sun, Jun 05, 2016 at 11:40:47PM +0200, Michael Niedermayer wrote:
> On Thu, Apr 07, 2016 at 08:08:41PM +0200, wm4 wrote:
> > On Thu,  7 Apr 2016 17:51:26 +0200
> > Michael Niedermayer <mich...@niedermayer.cc> wrote:
> > 
> > > Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
> > > ---
> > >  libavformat/format.c |   16 ++++++++++------
> > >  1 file changed, 10 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/libavformat/format.c b/libavformat/format.c
> > > index 15fe167..f0abb5d 100644
> > > --- a/libavformat/format.c
> > > +++ b/libavformat/format.c
> > > @@ -62,20 +62,24 @@ void av_register_input_format(AVInputFormat *format)
> > >  {
> > >      AVInputFormat **p = last_iformat;
> > >  
> > > -    format->next = NULL;
> > > -    while(*p || avpriv_atomic_ptr_cas((void * volatile *)p, NULL, 
> > > format))
> > > +    // Note, format could be added after the first 2 checks but that 
> > > implies that *p is no longer NULL
> > > +    while(p != &format->next && !format->next && 
> > > avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format))
> > >          p = &(*p)->next;
> > > -    last_iformat = &format->next;
> > > +
> > > +    if (!format->next)
> > > +        last_iformat = &format->next;
> > >  }
> > >  
> > >  void av_register_output_format(AVOutputFormat *format)
> > >  {
> > >      AVOutputFormat **p = last_oformat;
> > >  
> > > -    format->next = NULL;
> > > -    while(*p || avpriv_atomic_ptr_cas((void * volatile *)p, NULL, 
> > > format))
> > > +    // Note, format could be added after the first 2 checks but that 
> > > implies that *p is no longer NULL
> > > +    while(p != &format->next && !format->next && 
> > > avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format))
> > >          p = &(*p)->next;
> > > -    last_oformat = &format->next;
> > > +
> > > +    if (!format->next)
> > > +        last_oformat = &format->next;
> > >  }
> > >  
> > >  int av_match_ext(const char *filename, const char *extensions)
> > 
> > This is a giant heap of crap, and it's probably not easy to do much
> > better. Have you considered just using a mutex instead? We have the
> > equivalent of pthread_init_once on all platforms now.
> 
> it could be done with a mutex but it would be alot more code and
> it seems noone works on implementing that
> 
> so unles there are objections ill push this, leaving the race is worst
> of all options

applied

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to