diff --git a/Utilities/Log.cpp b/Utilities/Log.cpp index 0d2f21ca5a..0a685ae379 100644 --- a/Utilities/Log.cpp +++ b/Utilities/Log.cpp @@ -169,7 +169,7 @@ namespace logs for (auto&& pair : get_logger()->channels) { - pair.second->enabled = level::notice; + pair.second->enabled.store(level::notice, std::memory_order_relaxed); } } @@ -179,7 +179,7 @@ namespace logs for (auto&& pair : get_logger()->channels) { - pair.second->enabled = level::always; + pair.second->enabled.store(level::always, std::memory_order_relaxed); } } @@ -191,7 +191,7 @@ namespace logs while (found.first != found.second) { - found.first->second->enabled = value; + found.first->second->enabled.store(value, std::memory_order_relaxed); found.first++; } } @@ -204,7 +204,7 @@ namespace logs if (found.first != found.second) { - return found.first->second->enabled; + return found.first->second->enabled.load(std::memory_order_relaxed); } else { diff --git a/Utilities/Log.h b/Utilities/Log.h index 1a1e2431b8..d822e6119c 100644 --- a/Utilities/Log.h +++ b/Utilities/Log.h @@ -1,9 +1,9 @@ #pragma once #include "types.h" -#include "util/atomic.hpp" #include "StrFmt.h" -#include +#include "util/atomic.hpp" +#include namespace logs { @@ -59,7 +59,7 @@ namespace logs const char* const name; // The lowest logging level enabled for this channel (used for early filtering) - atomic_t enabled; + std::atomic enabled; // Initialize and register channel channel(const char* name); @@ -69,7 +69,7 @@ namespace logs template \ void _sev(const char(&fmt)[N], const Args&... args)\ {\ - if (UNLIKELY(level::_sev <= enabled))\ + if (UNLIKELY(level::_sev <= enabled.load(std::memory_order_relaxed)))\ {\ static constexpr fmt_type_info type_list[sizeof...(Args) + 1]{fmt_type_info::make>()...};\ msg_##_sev.broadcast(fmt, type_list, u64{fmt_unveil::get(args)}...);\