From 5683d16b362c29a8c0350f161b115f193c2c7ce2 Mon Sep 17 00:00:00 2001 From: gabime Date: Sat, 23 Sep 2023 00:55:47 +0300 Subject: [PATCH] Fix atomic level --- include/spdlog/details/null_mutex.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/spdlog/details/null_mutex.h b/include/spdlog/details/null_mutex.h index 58c9bd59..37a7e3c5 100644 --- a/include/spdlog/details/null_mutex.h +++ b/include/spdlog/details/null_mutex.h @@ -22,21 +22,23 @@ struct null_atomic { T value; - explicit null_atomic(T new_value) + null_atomic() = default; + + explicit constexpr null_atomic(T new_value) : value(new_value) {} - [[nodiscard]] T load(std::memory_order = std::memory_order_relaxed) const noexcept + [[nodiscard]] T load(std::memory_order = std::memory_order_seq_cst) const { return value; } - void store(T new_value, std::memory_order = std::memory_order_relaxed) noexcept + void store(T new_value, std::memory_order = std::memory_order_seq_cst) { value = new_value; } - T exchange(T new_value, std::memory_order = std::memory_order_relaxed) noexcept + T exchange(T new_value, std::memory_order = std::memory_order_seq_cst) { std::swap(new_value, value); return new_value; // return value before the call