[FFmpeg-devel] [RFC] avoid non-threadsafe localtime, gmtime

Reimar Döffinger Reimar.Doeffinger
Sat Feb 7 16:32:43 CET 2009


On Sat, Feb 07, 2009 at 04:19:22PM +0100, Reimar D?ffinger wrote:
> On Sat, Feb 07, 2009 at 02:18:09PM +0100, Reimar D?ffinger wrote:
> > On Sat, Feb 07, 2009 at 01:24:19PM +0100, Michael Niedermayer wrote:
> > > On Sat, Feb 07, 2009 at 12:02:03PM +0100, Reimar D?ffinger wrote:
> > > > attached patch would be the first step to get rid of the non-threadsafe
> > > > localtime and gmtime functions.
> > > > It should work on all POSIX and current Windows versions.
> > > > For anything else it would still be a simple hack to add support to
> > > > fallback to the non-threadsafe functions, only libavformat then would
> > > > not be thread-safe which keeps the probability of issues quite low.
> > > 
> > > fine, though i must add the ifdefs are ugly
> > 
> > If you find that ugly, you'll certainly be jumping with joy at the end
> > of the email.
> 
> Even better, when using localtime_r you must ensure that someone called
> the (possibly non-thread-safe) tzset function before.
> Didn't anyone have their brains with them when they designed that mess?

You know, I just had the idea of a genius ( :-P ): Simply let the
libavformat users register callbacks to do all this conversion stuff.
I just noticed that we also have the special joy of having our own
replacement of gmtime_r, called brktimegm, which is not POSIX-compliant it
seems.
I am really on the verge of suggesting to rip out _any and all_ time
handling until someone does it properly.




More information about the ffmpeg-devel mailing list