Merge pull request #9827 from Icinga/application-m_lastreloadfailed-uint32_t

Application::m_LastReloadFailed: if double isn't always lock free, use uint32_t
This commit is contained in:
Alexander Aleksandrovič Klimov 2023-07-10 14:14:58 +02:00 committed by GitHub
commit 1df14d60d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -9,7 +9,9 @@
#include "base/logger.hpp" #include "base/logger.hpp"
#include "base/configuration.hpp" #include "base/configuration.hpp"
#include "base/shared-memory.hpp" #include "base/shared-memory.hpp"
#include <cstdint>
#include <iosfwd> #include <iosfwd>
#include <type_traits>
namespace icinga namespace icinga
{ {
@ -142,7 +144,7 @@ private:
#ifdef _WIN32 #ifdef _WIN32
static double m_LastReloadFailed; static double m_LastReloadFailed;
#else /* _WIN32 */ #else /* _WIN32 */
typedef Atomic<double> AtomicTs; typedef Atomic<std::conditional_t<Atomic<double>::is_always_lock_free, double, uint32_t>> AtomicTs;
static_assert(AtomicTs::is_always_lock_free); static_assert(AtomicTs::is_always_lock_free);
static SharedMemory<AtomicTs> m_LastReloadFailed; static SharedMemory<AtomicTs> m_LastReloadFailed;
#endif /* _WIN32 */ #endif /* _WIN32 */