]> git.sesse.net Git - ffmpeg/commit
avutil/cpu: Fix race condition in av_cpu_count()
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 2 Dec 2020 22:57:16 +0000 (23:57 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Fri, 2 Apr 2021 17:12:43 +0000 (19:12 +0200)
commita2a38b160620d91bc3f895dadc4501c589998b9c
tree069b85d66253830a524b0ba61413c793a9662c60
parentf38f791a23a8acade7ea6554c80455dce7543dbd
avutil/cpu: Fix race condition in av_cpu_count()

av_cpu_count() intends to emit a debug message containing the number of
logical cores when called the first time. The check currently works with
a static volatile int; yet this does not help at all in case of
concurrent accesses by multiple threads. So replace this with an
atomic_int.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavutil/cpu.c