Application::m_LastReloadFailed: if double isn't always lock free, use uint32_t

which will overflow in 2106, not 2038.
This fixes a compile failure on 32-bit Raspbian.
This commit is contained in:
Alexander A. Klimov 2023-07-10 10:51:02 +02:00
parent 000a776dfb
commit 8f8a6ee2a0

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 */