diff options
author | matoro <matoro@users.noreply.github.com> | 2022-07-09 23:44:00 -0400 |
---|---|---|
committer | matoro <matoro@users.noreply.github.com> | 2022-07-14 17:34:15 -0400 |
commit | 9ddb63f5cf457ce612404864af97559bf60a9014 (patch) | |
tree | 22274fa8ebbcc91276fa95a27a1b927d7b9dc85b /src/fundamental | |
parent | 8a75ba0a7f8b127614460d022ba313b5dba6af25 (diff) | |
download | systemd-9ddb63f5cf457ce612404864af97559bf60a9014.tar.gz |
fundamental: replace __sync with __atomic in ONCE macro
For this one, we can actually just use __atomic_exchange_n since we
don't need the "compare" part of __atomic_compare_exchange_n.
Diffstat (limited to 'src/fundamental')
-rw-r--r-- | src/fundamental/macro-fundamental.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h index a738b1f50e..7cc34b6f1a 100644 --- a/src/fundamental/macro-fundamental.h +++ b/src/fundamental/macro-fundamental.h @@ -106,10 +106,10 @@ * on this macro will run concurrently to all other code conditionalized * the same way, there's no ordering or completion enforced. */ #define ONCE __ONCE(UNIQ_T(_once_, UNIQ)) -#define __ONCE(o) \ - ({ \ - static bool (o) = false; \ - __sync_bool_compare_and_swap(&(o), false, true); \ +#define __ONCE(o) \ + ({ \ + static bool (o) = false; \ + __atomic_exchange_n(&(o), true, __ATOMIC_SEQ_CST); \ }) #undef MAX |