[FFmpeg-devel] [PATCH] avutil: fix data race in av_get_cpu_flags().

Wan-Teh Chang wtc at google.com
Wed Nov 23 01:05:36 EET 2016


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().

Thanks,
Wan-Teh Chang


More information about the ffmpeg-devel mailing list