[FFmpeg-devel] [PATCH] avutil: fix data race in av_get_cpu_flags().
wm4
nfxjfg at googlemail.com
Wed Nov 23 01:32:38 EET 2016
On Tue, 22 Nov 2016 15:05:36 -0800
Wan-Teh Chang <wtc-at-google.com at ffmpeg.org> wrote:
> Hi wm4,
>
> On Tue, Nov 22, 2016 at 1:41 PM, wm4 <nfxjfg at googlemail.com> wrote:
> >
> > Again, once the atomics changes in Libav are merged, the avpriv_atomic_
> > additions will have to be deleted, and code using it rewritten.
>
> Thanks for the heads-up. Is there an atomics patch for libav being
> reviewed right now?
>
> I inspected the libav code this morning after I read your earlier
> message. The current atomics code in libav ignores the memory order
> argument, so the "relaxed" memory order isn't implemented in the
> current libav.
>
> For example, the current revision of libav/compat/atomics/gcc/stdatomic.h has:
>
> ==========
> #define atomic_store(object, desired) \
> do { \
> *(object) = (desired); \
> __sync_synchronize(); \
> } while (0)
>
> #define atomic_store_explicit(object, desired, order) \
> atomic_store(object, desired)
>
> #define atomic_load(object) \
> (__sync_synchronize(), *(object))
>
> #define atomic_load_explicit(object, order) \
> atomic_load(object)
> ==========
>
> So I am wondering if there is a libav patch that implements the
> |order| argument for atomic_store_explicit() and
> atomic_load_explicit().
>
This is emulation code for compilers which don't provide C11 atomics.
All relevant compilers provide them natively (and presumably implement
the weaker semantics). Except MSVC I guess, but it's well known that
libavcodec runs slower when compiled with MSVC anyway.
More information about the ffmpeg-devel
mailing list