1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-29 22:00:58 +02:00
FFmpeg/libavutil
Wan-Teh Chang 2170017a1c avutil: fix data race in av_get_cpu_flags()
Make the one-time initialization in av_get_cpu_flags() thread-safe. The
static variables |flags|, |cpuflags_mask|, and |checked| in
libavutil/cpu.c are read and written using normal load and store
operations. These are considered as data races. The fix is to use atomic
load and store operations.

Remove the |checked| variable because the invalid value of -1 for
|flags| can be used to indicate the same condition. Rename |flags| to
|cpu_flags| and move it to file scope.

The fix can be verified by running the libavutil/tests/cpu_init.c test
program under ThreadSanitizer:
    ./configure --toolchain=clang-tsan
    make libavutil/tests/cpu_init
    libavutil/tests/cpu_init

There should be no warnings from ThreadSanitizer.

Co-author: Dmitry Vyukov of Google, who suggested the data race fix.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
2016-12-08 15:53:58 -05:00
..
2016-05-04 18:16:21 +02:00
2016-05-04 18:16:21 +02:00
2015-07-31 09:04:09 +02:00
2016-10-02 18:58:04 +02:00
2016-10-02 18:58:04 +02:00
2016-05-10 11:30:25 +02:00
2015-08-31 17:06:32 +02:00
2016-05-04 18:16:21 +02:00
2015-02-14 10:13:49 -08:00
2015-07-29 22:09:16 +03:00
2016-11-03 23:49:01 +00:00
2016-08-03 10:56:52 +02:00
2016-05-04 18:16:21 +02:00
2016-09-03 15:11:29 +02:00
2016-05-04 18:16:21 +02:00
2016-05-04 18:16:21 +02:00
2015-07-31 09:04:12 +02:00
2015-07-31 09:04:12 +02:00
2015-12-14 16:42:35 +01:00