From e4610e7dbdb57bd62b714fddbf0e421975d13d23 Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Mon, 16 Nov 2020 17:38:03 +0100 Subject: [PATCH] Use std::mutex instead of Spinlock --- lib/remote/apilistener-filesync.cpp | 4 ++-- lib/remote/apilistener.hpp | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/remote/apilistener-filesync.cpp b/lib/remote/apilistener-filesync.cpp index 2ab42870e..1598b4221 100644 --- a/lib/remote/apilistener-filesync.cpp +++ b/lib/remote/apilistener-filesync.cpp @@ -20,7 +20,7 @@ using namespace icinga; REGISTER_APIFUNCTION(Update, config, &ApiListener::ConfigUpdateHandler); -SpinLock ApiListener::m_ConfigSyncStageLock; +std::mutex ApiListener::m_ConfigSyncStageLock; /** * Entrypoint for updating all authoritative configs from /etc/zones.d, packages, etc. @@ -330,7 +330,7 @@ void ApiListener::HandleConfigUpdate(const MessageOrigin::Ptr& origin, const Dic /* Only one transaction is allowed, concurrent message handlers need to wait. * This affects two parent endpoints sending the config in the same moment. */ - auto lock (Shared>::Make(m_ConfigSyncStageLock)); + std::lock_guard lock(m_ConfigSyncStageLock); String apiZonesStageDir = GetApiZonesStageDir(); String fromEndpointName = origin->FromClient->GetEndpoint()->GetName(); diff --git a/lib/remote/apilistener.hpp b/lib/remote/apilistener.hpp index 41993bebb..eb80dafaa 100644 --- a/lib/remote/apilistener.hpp +++ b/lib/remote/apilistener.hpp @@ -11,7 +11,6 @@ #include "base/configobject.hpp" #include "base/process.hpp" #include "base/shared.hpp" -#include "base/spinlock.hpp" #include "base/timer.hpp" #include "base/workqueue.hpp" #include "base/tcpsocket.hpp" @@ -188,7 +187,7 @@ private: void RemoveStatusFile(); /* filesync */ - static SpinLock m_ConfigSyncStageLock; + static std::mutex m_ConfigSyncStageLock; void SyncLocalZoneDirs() const; void SyncLocalZoneDir(const Zone::Ptr& zone) const;