diff --git a/common/msg.c b/common/msg.c index 3092845a02..2ae52a4dda 100644 --- a/common/msg.c +++ b/common/msg.c @@ -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; } diff --git a/osdep/atomics.h b/osdep/atomics.h index 39c741acd7..8431211476 100644 --- a/osdep/atomics.h +++ b/osdep/atomics.h @@ -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) \