1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Stop misusing volatile keyword

This commit is contained in:
sfan5 2024-05-14 19:26:22 +02:00
parent 4c9be808a7
commit 27cb54c1db
4 changed files with 11 additions and 11 deletions

View file

@ -79,6 +79,10 @@ public:
return m_has_outputs[level].load(std::memory_order_relaxed);
}
bool isLevelSilenced(LogLevel level) {
return m_silenced_levels[level].load(std::memory_order_relaxed);
}
static LogColor color_mode;
private:
@ -91,11 +95,7 @@ private:
std::vector<ILogOutput *> m_outputs[LL_MAX];
std::atomic<bool> m_has_outputs[LL_MAX];
// Should implement atomic loads and stores (even though it's only
// written to when one thread has access currently).
// Works on all known architectures (x86, ARM, MIPS).
volatile bool m_silenced_levels[LL_MAX];
std::atomic<bool> m_silenced_levels[LL_MAX];
std::map<std::thread::id, std::string> m_thread_names;
mutable std::mutex m_mutex;
};