mirror of https://github.com/mpv-player/mpv
msg: use relaxed atomics for log level test
This should be sufficient.
If stdatomic.h is not available, we make no difference.
(cherry picked from commit 01b87e509c
)
This commit is contained in:
parent
e682d82527
commit
931f614257
|
@ -136,8 +136,11 @@ bool mp_msg_test(struct mp_log *log, int lev)
|
|||
struct mp_log_root *root = log->root;
|
||||
if (!root || root->mute)
|
||||
return false;
|
||||
if (atomic_load(&log->reload_counter) != atomic_load(&root->reload_counter))
|
||||
if (atomic_load_explicit(&log->reload_counter, memory_order_relaxed) !=
|
||||
atomic_load_explicit(&root->reload_counter, memory_order_relaxed))
|
||||
{
|
||||
update_loglevel(log);
|
||||
}
|
||||
return lev <= log->level;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,11 @@ typedef struct { volatile unsigned long long v; } atomic_ullong;
|
|||
#define ATOMIC_VAR_INIT(x) \
|
||||
{.v = (x)}
|
||||
|
||||
#define memory_order_relaxed 1
|
||||
#define memory_order_seq_cst 2
|
||||
|
||||
#define atomic_load_explicit(p, e) atomic_load(p)
|
||||
|
||||
#if HAVE_ATOMIC_BUILTINS
|
||||
|
||||
#define atomic_load(p) \
|
||||
|
|
Loading…
Reference in New Issue