mirror of https://github.com/Icinga/icinga2.git
Use std::mutex, not boost::mutex
This commit is contained in:
parent
ef23ae5f3c
commit
c3388e9af6
|
@ -11,7 +11,7 @@ ConfigType::~ConfigType()
|
|||
|
||||
ConfigObject::Ptr ConfigType::GetObject(const String& name) const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
auto nt = m_ObjectMap.find(name);
|
||||
|
||||
|
@ -26,7 +26,7 @@ void ConfigType::RegisterObject(const ConfigObject::Ptr& object)
|
|||
String name = object->GetName();
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
auto it = m_ObjectMap.find(name);
|
||||
|
||||
|
@ -51,7 +51,7 @@ void ConfigType::UnregisterObject(const ConfigObject::Ptr& object)
|
|||
String name = object->GetName();
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
m_ObjectMap.erase(name);
|
||||
m_ObjectVector.erase(std::remove(m_ObjectVector.begin(), m_ObjectVector.end(), object), m_ObjectVector.end());
|
||||
|
@ -60,7 +60,7 @@ void ConfigType::UnregisterObject(const ConfigObject::Ptr& object)
|
|||
|
||||
std::vector<ConfigObject::Ptr> ConfigType::GetObjects() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
return m_ObjectVector;
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,6 @@ std::vector<ConfigObject::Ptr> ConfigType::GetObjectsHelper(Type *type)
|
|||
|
||||
int ConfigType::GetObjectCount() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
return m_ObjectVector.size();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "base/object.hpp"
|
||||
#include "base/type.hpp"
|
||||
#include "base/dictionary.hpp"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <mutex>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ private:
|
|||
typedef std::map<String, intrusive_ptr<ConfigObject> > ObjectMap;
|
||||
typedef std::vector<intrusive_ptr<ConfigObject> > ObjectVector;
|
||||
|
||||
mutable boost::mutex m_Mutex;
|
||||
mutable std::mutex m_Mutex;
|
||||
ObjectMap m_ObjectMap;
|
||||
ObjectVector m_ObjectVector;
|
||||
|
||||
|
|
|
@ -130,10 +130,10 @@ void ConfigWriter::EmitIndent(std::ostream& fp, int indentLevel)
|
|||
void ConfigWriter::EmitIdentifier(std::ostream& fp, const String& identifier, bool inAssignment)
|
||||
{
|
||||
static std::set<String> keywords;
|
||||
static boost::mutex mutex;
|
||||
static std::mutex mutex;
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(mutex);
|
||||
std::unique_lock<std::mutex> lock(mutex);
|
||||
if (keywords.empty()) {
|
||||
const std::vector<String>& vkeywords = GetKeywords();
|
||||
std::copy(vkeywords.begin(), vkeywords.end(), std::inserter(keywords, keywords.begin()));
|
||||
|
@ -203,8 +203,8 @@ String ConfigWriter::EscapeIcingaString(const String& str)
|
|||
const std::vector<String>& ConfigWriter::GetKeywords()
|
||||
{
|
||||
static std::vector<String> keywords;
|
||||
static boost::mutex mutex;
|
||||
boost::mutex::scoped_lock lock(mutex);
|
||||
static std::mutex mutex;
|
||||
std::unique_lock<std::mutex> lock(mutex);
|
||||
|
||||
if (keywords.empty()) {
|
||||
keywords.emplace_back("object");
|
||||
|
|
|
@ -4,18 +4,18 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
boost::mutex DependencyGraph::m_Mutex;
|
||||
std::mutex DependencyGraph::m_Mutex;
|
||||
std::map<Object *, std::map<Object *, int> > DependencyGraph::m_Dependencies;
|
||||
|
||||
void DependencyGraph::AddDependency(Object *parent, Object *child)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
m_Dependencies[child][parent]++;
|
||||
}
|
||||
|
||||
void DependencyGraph::RemoveDependency(Object *parent, Object *child)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
auto& refs = m_Dependencies[child];
|
||||
auto it = refs.find(parent);
|
||||
|
@ -36,7 +36,7 @@ std::vector<Object::Ptr> DependencyGraph::GetParents(const Object::Ptr& child)
|
|||
{
|
||||
std::vector<Object::Ptr> objects;
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
auto it = m_Dependencies.find(child.get());
|
||||
|
||||
if (it != m_Dependencies.end()) {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
#include "base/i2-base.hpp"
|
||||
#include "base/object.hpp"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
namespace icinga {
|
||||
|
||||
|
@ -25,7 +25,7 @@ public:
|
|||
private:
|
||||
DependencyGraph();
|
||||
|
||||
static boost::mutex m_Mutex;
|
||||
static std::mutex m_Mutex;
|
||||
static std::map<Object *, std::map<Object *, int> > m_Dependencies;
|
||||
};
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ template Log& Log::operator<<(const double&);
|
|||
REGISTER_TYPE(Logger);
|
||||
|
||||
std::set<Logger::Ptr> Logger::m_Loggers;
|
||||
boost::mutex Logger::m_Mutex;
|
||||
std::mutex Logger::m_Mutex;
|
||||
bool Logger::m_ConsoleLogEnabled = true;
|
||||
bool Logger::m_TimestampEnabled = true;
|
||||
LogSeverity Logger::m_ConsoleLogSeverity = LogInformation;
|
||||
|
@ -47,14 +47,14 @@ void Logger::Start(bool runtimeCreated)
|
|||
{
|
||||
ObjectImpl<Logger>::Start(runtimeCreated);
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
m_Loggers.insert(this);
|
||||
}
|
||||
|
||||
void Logger::Stop(bool runtimeRemoved)
|
||||
{
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
m_Loggers.erase(this);
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ void Logger::Stop(bool runtimeRemoved)
|
|||
|
||||
std::set<Logger::Ptr> Logger::GetLoggers()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
return m_Loggers;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ protected:
|
|||
void Stop(bool runtimeRemoved) override;
|
||||
|
||||
private:
|
||||
static boost::mutex m_Mutex;
|
||||
static std::mutex m_Mutex;
|
||||
static std::set<Logger::Ptr> m_Loggers;
|
||||
static bool m_ConsoleLogEnabled;
|
||||
static bool m_TimestampEnabled;
|
||||
|
|
|
@ -17,7 +17,7 @@ using namespace icinga;
|
|||
DEFINE_TYPE_INSTANCE(Object);
|
||||
|
||||
#ifdef I2_LEAK_DEBUG
|
||||
static boost::mutex l_ObjectCountLock;
|
||||
static std::mutex l_ObjectCountLock;
|
||||
static std::map<String, int> l_ObjectCounts;
|
||||
static Timer::Ptr l_ObjectCountTimer;
|
||||
#endif /* I2_LEAK_DEBUG */
|
||||
|
@ -203,21 +203,21 @@ Value icinga::GetPrototypeField(const Value& context, const String& field, bool
|
|||
#ifdef I2_LEAK_DEBUG
|
||||
void icinga::TypeAddObject(Object *object)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_ObjectCountLock);
|
||||
std::unique_lock<std::mutex> lock(l_ObjectCountLock);
|
||||
String typeName = Utility::GetTypeName(typeid(*object));
|
||||
l_ObjectCounts[typeName]++;
|
||||
}
|
||||
|
||||
void icinga::TypeRemoveObject(Object *object)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_ObjectCountLock);
|
||||
std::unique_lock<std::mutex> lock(l_ObjectCountLock);
|
||||
String typeName = Utility::GetTypeName(typeid(*object));
|
||||
l_ObjectCounts[typeName]--;
|
||||
}
|
||||
|
||||
static void TypeInfoTimerHandler()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_ObjectCountLock);
|
||||
std::unique_lock<std::mutex> lock(l_ObjectCountLock);
|
||||
|
||||
typedef std::map<String, int>::value_type kv_pair;
|
||||
for (kv_pair& kv : l_ObjectCounts) {
|
||||
|
|
|
@ -33,7 +33,7 @@ using namespace icinga;
|
|||
|
||||
#define IOTHREADS 4
|
||||
|
||||
static boost::mutex l_ProcessMutex[IOTHREADS];
|
||||
static std::mutex l_ProcessMutex[IOTHREADS];
|
||||
static std::map<Process::ProcessHandle, Process::Ptr> l_Processes[IOTHREADS];
|
||||
#ifdef _WIN32
|
||||
static HANDLE l_Events[IOTHREADS];
|
||||
|
@ -41,7 +41,7 @@ static HANDLE l_Events[IOTHREADS];
|
|||
static int l_EventFDs[IOTHREADS][2];
|
||||
static std::map<Process::ConsoleHandle, Process::ProcessHandle> l_FDs[IOTHREADS];
|
||||
|
||||
static boost::mutex l_ProcessControlMutex;
|
||||
static std::mutex l_ProcessControlMutex;
|
||||
static int l_ProcessControlFD = -1;
|
||||
static pid_t l_ProcessControlPID;
|
||||
#endif /* _WIN32 */
|
||||
|
@ -372,7 +372,7 @@ static pid_t ProcessSpawn(const std::vector<String>& arguments, const Dictionary
|
|||
String jrequest = JsonEncode(request);
|
||||
size_t length = jrequest.GetLength();
|
||||
|
||||
boost::mutex::scoped_lock lock(l_ProcessControlMutex);
|
||||
std::unique_lock<std::mutex> lock(l_ProcessControlMutex);
|
||||
|
||||
struct msghdr msg;
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
|
@ -431,7 +431,7 @@ static int ProcessKill(pid_t pid, int signum)
|
|||
String jrequest = JsonEncode(request);
|
||||
size_t length = jrequest.GetLength();
|
||||
|
||||
boost::mutex::scoped_lock lock(l_ProcessControlMutex);
|
||||
std::unique_lock<std::mutex> lock(l_ProcessControlMutex);
|
||||
|
||||
do {
|
||||
while (send(l_ProcessControlFD, &length, sizeof(length), 0) < 0) {
|
||||
|
@ -462,7 +462,7 @@ static int ProcessWaitPID(pid_t pid, int *status)
|
|||
String jrequest = JsonEncode(request);
|
||||
size_t length = jrequest.GetLength();
|
||||
|
||||
boost::mutex::scoped_lock lock(l_ProcessControlMutex);
|
||||
std::unique_lock<std::mutex> lock(l_ProcessControlMutex);
|
||||
|
||||
do {
|
||||
while (send(l_ProcessControlFD, &length, sizeof(length), 0) < 0) {
|
||||
|
@ -606,7 +606,7 @@ void Process::IOThreadProc(int tid)
|
|||
now = Utility::GetTime();
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_ProcessMutex[tid]);
|
||||
std::unique_lock<std::mutex> lock(l_ProcessMutex[tid]);
|
||||
|
||||
count = 1 + l_Processes[tid].size();
|
||||
#ifdef _WIN32
|
||||
|
@ -675,7 +675,7 @@ void Process::IOThreadProc(int tid)
|
|||
now = Utility::GetTime();
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_ProcessMutex[tid]);
|
||||
std::unique_lock<std::mutex> lock(l_ProcessMutex[tid]);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (rc == WAIT_OBJECT_0)
|
||||
|
@ -990,7 +990,7 @@ void Process::Run(const std::function<void(const ProcessResult&)>& callback)
|
|||
int tid = GetTID();
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_ProcessMutex[tid]);
|
||||
std::unique_lock<std::mutex> lock(l_ProcessMutex[tid]);
|
||||
l_Processes[tid][m_Process] = this;
|
||||
#ifndef _WIN32
|
||||
l_FDs[tid][m_FD] = m_Process;
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
#include "base/i2-base.hpp"
|
||||
#include "base/string.hpp"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/signals2.hpp>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ public:
|
|||
|
||||
void RegisterIfNew(const String& name, const T& item)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
if (m_Items.find(name) != m_Items.end())
|
||||
return;
|
||||
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
void Register(const String& name, const T& item)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
RegisterInternal(name, item, lock);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public:
|
|||
size_t erased;
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
erased = m_Items.erase(name);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
typename Registry<U, T>::ItemMap items;
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
items = m_Items;
|
||||
}
|
||||
|
||||
|
@ -67,14 +67,14 @@ public:
|
|||
}
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
m_Items.clear();
|
||||
}
|
||||
}
|
||||
|
||||
T GetItem(const String& name) const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
auto it = m_Items.find(name);
|
||||
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
|
||||
ItemMap GetItems() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
return m_Items; /* Makes a copy of the map. */
|
||||
}
|
||||
|
@ -95,10 +95,10 @@ public:
|
|||
boost::signals2::signal<void (const String&)> OnUnregistered;
|
||||
|
||||
private:
|
||||
mutable boost::mutex m_Mutex;
|
||||
mutable std::mutex m_Mutex;
|
||||
typename Registry<U, T>::ItemMap m_Items;
|
||||
|
||||
void RegisterInternal(const String& name, const T& item, boost::mutex::scoped_lock& lock)
|
||||
void RegisterInternal(const String& name, const T& item, std::unique_lock<std::mutex>& lock)
|
||||
{
|
||||
bool old_item = false;
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@ RingBuffer::RingBuffer(RingBuffer::SizeType slots)
|
|||
|
||||
RingBuffer::SizeType RingBuffer::GetLength() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
return m_Slots.size();
|
||||
}
|
||||
|
||||
void RingBuffer::InsertValue(RingBuffer::SizeType tv, int num)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
InsertValueUnlocked(tv, num);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ void RingBuffer::InsertValueUnlocked(RingBuffer::SizeType tv, int num)
|
|||
|
||||
int RingBuffer::UpdateAndGetValues(RingBuffer::SizeType tv, RingBuffer::SizeType span)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
return UpdateAndGetValuesUnlocked(tv, span);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ int RingBuffer::UpdateAndGetValuesUnlocked(RingBuffer::SizeType tv, RingBuffer::
|
|||
|
||||
double RingBuffer::CalculateRate(RingBuffer::SizeType tv, RingBuffer::SizeType span)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
int sum = UpdateAndGetValuesUnlocked(tv, span);
|
||||
return sum / static_cast<double>(std::min(span, m_InsertedValues));
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
#include "base/i2-base.hpp"
|
||||
#include "base/object.hpp"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
double CalculateRate(SizeType tv, SizeType span);
|
||||
|
||||
private:
|
||||
mutable boost::mutex m_Mutex;
|
||||
mutable std::mutex m_Mutex;
|
||||
std::vector<int> m_Slots;
|
||||
SizeType m_TimeValue;
|
||||
SizeType m_InsertedValues;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#define SINGLETON_H
|
||||
|
||||
#include "base/i2-base.hpp"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
|
|
@ -145,7 +145,7 @@ std::pair<String, String> Socket::GetDetailsFromSockaddr(sockaddr *address, sock
|
|||
*/
|
||||
std::pair<String, String> Socket::GetClientAddressDetails()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_SocketMutex);
|
||||
std::unique_lock<std::mutex> lock(m_SocketMutex);
|
||||
|
||||
sockaddr_storage sin;
|
||||
socklen_t len = sizeof(sin);
|
||||
|
@ -195,7 +195,7 @@ String Socket::GetClientAddress()
|
|||
*/
|
||||
std::pair<String, String> Socket::GetPeerAddressDetails()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_SocketMutex);
|
||||
std::unique_lock<std::mutex> lock(m_SocketMutex);
|
||||
|
||||
sockaddr_storage sin;
|
||||
socklen_t len = sizeof(sin);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "base/i2-base.hpp"
|
||||
#include "base/object.hpp"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <mutex>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ protected:
|
|||
|
||||
int GetError() const;
|
||||
|
||||
mutable boost::mutex m_SocketMutex;
|
||||
mutable std::mutex m_SocketMutex;
|
||||
|
||||
private:
|
||||
SOCKET m_FD{INVALID_SOCKET}; /**< The socket descriptor. */
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "base/stream.hpp"
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <chrono>
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
|
@ -38,7 +39,7 @@ void Stream::SignalDataAvailable()
|
|||
OnDataAvailable(this);
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
m_CV.notify_all();
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +49,7 @@ bool Stream::WaitForData()
|
|||
if (!SupportsWaiting())
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Stream does not support waiting."));
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
while (!IsDataAvailable() && !IsEof())
|
||||
m_CV.wait(lock);
|
||||
|
@ -58,20 +59,17 @@ bool Stream::WaitForData()
|
|||
|
||||
bool Stream::WaitForData(int timeout)
|
||||
{
|
||||
namespace ch = std::chrono;
|
||||
|
||||
if (!SupportsWaiting())
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Stream does not support waiting."));
|
||||
|
||||
if (timeout < 0)
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Timeout can't be negative"));
|
||||
|
||||
boost::system_time const point_of_timeout = boost::get_system_time() + boost::posix_time::seconds(timeout);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
|
||||
while (!IsDataAvailable() && !IsEof() && point_of_timeout > boost::get_system_time())
|
||||
m_CV.timed_wait(lock, point_of_timeout);
|
||||
|
||||
return IsDataAvailable() || IsEof();
|
||||
return m_CV.wait_for(lock, ch::duration<int>(timeout), [this]() { return IsDataAvailable() || IsEof(); });
|
||||
}
|
||||
|
||||
static void StreamDummyCallback()
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#include "base/i2-base.hpp"
|
||||
#include "base/object.hpp"
|
||||
#include <boost/signals2.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
@ -124,8 +124,8 @@ protected:
|
|||
private:
|
||||
boost::signals2::signal<void(const Stream::Ptr&)> OnDataAvailable;
|
||||
|
||||
boost::mutex m_Mutex;
|
||||
boost::condition_variable m_CV;
|
||||
std::mutex m_Mutex;
|
||||
std::condition_variable m_CV;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ using namespace icinga;
|
|||
|
||||
REGISTER_TYPE(StreamLogger);
|
||||
|
||||
boost::mutex StreamLogger::m_Mutex;
|
||||
std::mutex StreamLogger::m_Mutex;
|
||||
|
||||
void StreamLogger::Stop(bool runtimeRemoved)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ void StreamLogger::ProcessLogEntry(std::ostream& stream, const LogEntry& entry)
|
|||
{
|
||||
String timestamp = Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", entry.Timestamp);
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
if (Logger::IsTimestampEnabled())
|
||||
stream << "[" << timestamp << "] ";
|
||||
|
|
|
@ -33,7 +33,7 @@ protected:
|
|||
void Flush() final;
|
||||
|
||||
private:
|
||||
static boost::mutex m_Mutex;
|
||||
static std::mutex m_Mutex;
|
||||
std::ostream *m_Stream{nullptr};
|
||||
bool m_OwnsStream{false};
|
||||
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
#include "base/debug.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
#include <boost/multi_index/key_extractors.hpp>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
using namespace icinga;
|
||||
|
@ -51,8 +52,8 @@ typedef boost::multi_index_container<
|
|||
>
|
||||
> TimerSet;
|
||||
|
||||
static boost::mutex l_TimerMutex;
|
||||
static boost::condition_variable l_TimerCV;
|
||||
static std::mutex l_TimerMutex;
|
||||
static std::condition_variable l_TimerCV;
|
||||
static std::thread l_TimerThread;
|
||||
static bool l_StopTimerThread;
|
||||
static TimerSet l_Timers;
|
||||
|
@ -70,7 +71,7 @@ Timer::~Timer()
|
|||
|
||||
void Timer::Initialize()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_TimerMutex);
|
||||
std::unique_lock<std::mutex> lock(l_TimerMutex);
|
||||
|
||||
if (l_AliveTimers > 0) {
|
||||
InitializeThread();
|
||||
|
@ -79,7 +80,7 @@ void Timer::Initialize()
|
|||
|
||||
void Timer::Uninitialize()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_TimerMutex);
|
||||
std::unique_lock<std::mutex> lock(l_TimerMutex);
|
||||
|
||||
if (l_AliveTimers > 0) {
|
||||
UninitializeThread();
|
||||
|
@ -130,7 +131,7 @@ void Timer::Call()
|
|||
*/
|
||||
void Timer::SetInterval(double interval)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_TimerMutex);
|
||||
std::unique_lock<std::mutex> lock(l_TimerMutex);
|
||||
m_Interval = interval;
|
||||
}
|
||||
|
||||
|
@ -141,7 +142,7 @@ void Timer::SetInterval(double interval)
|
|||
*/
|
||||
double Timer::GetInterval() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_TimerMutex);
|
||||
std::unique_lock<std::mutex> lock(l_TimerMutex);
|
||||
return m_Interval;
|
||||
}
|
||||
|
||||
|
@ -151,7 +152,7 @@ double Timer::GetInterval() const
|
|||
void Timer::Start()
|
||||
{
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_TimerMutex);
|
||||
std::unique_lock<std::mutex> lock(l_TimerMutex);
|
||||
m_Started = true;
|
||||
|
||||
if (++l_AliveTimers == 1) {
|
||||
|
@ -170,7 +171,7 @@ void Timer::Stop(bool wait)
|
|||
if (l_StopTimerThread)
|
||||
return;
|
||||
|
||||
boost::mutex::scoped_lock lock(l_TimerMutex);
|
||||
std::unique_lock<std::mutex> lock(l_TimerMutex);
|
||||
|
||||
if (m_Started && --l_AliveTimers == 0) {
|
||||
UninitializeThread();
|
||||
|
@ -200,7 +201,7 @@ void Timer::Reschedule(double next)
|
|||
*/
|
||||
void Timer::InternalReschedule(bool completed, double next)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_TimerMutex);
|
||||
std::unique_lock<std::mutex> lock(l_TimerMutex);
|
||||
|
||||
if (completed)
|
||||
m_Running = false;
|
||||
|
@ -232,7 +233,7 @@ void Timer::InternalReschedule(bool completed, double next)
|
|||
*/
|
||||
double Timer::GetNext() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_TimerMutex);
|
||||
std::unique_lock<std::mutex> lock(l_TimerMutex);
|
||||
return m_Next;
|
||||
}
|
||||
|
||||
|
@ -244,7 +245,7 @@ double Timer::GetNext() const
|
|||
*/
|
||||
void Timer::AdjustTimers(double adjustment)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_TimerMutex);
|
||||
std::unique_lock<std::mutex> lock(l_TimerMutex);
|
||||
|
||||
double now = Utility::GetTime();
|
||||
|
||||
|
@ -275,12 +276,14 @@ void Timer::AdjustTimers(double adjustment)
|
|||
*/
|
||||
void Timer::TimerThreadProc()
|
||||
{
|
||||
namespace ch = std::chrono;
|
||||
|
||||
Log(LogDebug, "Timer", "TimerThreadProc started.");
|
||||
|
||||
Utility::SetThreadName("Timer Thread");
|
||||
|
||||
for (;;) {
|
||||
boost::mutex::scoped_lock lock(l_TimerMutex);
|
||||
std::unique_lock<std::mutex> lock(l_TimerMutex);
|
||||
|
||||
typedef boost::multi_index::nth_index<TimerSet, 1>::type NextTimerView;
|
||||
NextTimerView& idx = boost::get<1>(l_Timers);
|
||||
|
@ -295,11 +298,11 @@ void Timer::TimerThreadProc()
|
|||
auto it = idx.begin();
|
||||
Timer *timer = *it;
|
||||
|
||||
double wait = timer->m_Next - Utility::GetTime();
|
||||
ch::time_point<ch::system_clock, ch::duration<double>> next (ch::duration<double>(timer->m_Next));
|
||||
|
||||
if (wait > 0.01) {
|
||||
if (next - ch::system_clock::now() > ch::duration<double>(0.01)) {
|
||||
/* Wait for the next timer. */
|
||||
l_TimerCV.timed_wait(lock, boost::posix_time::milliseconds(long(wait * 1000)));
|
||||
l_TimerCV.wait_until(lock, next);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ namespace icinga
|
|||
{
|
||||
|
||||
static bool l_SSLInitialized = false;
|
||||
static boost::mutex *l_Mutexes;
|
||||
static boost::mutex l_RandomMutex;
|
||||
static std::mutex *l_Mutexes;
|
||||
static std::mutex l_RandomMutex;
|
||||
|
||||
String GetOpenSSLVersion()
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ void InitializeOpenSSL()
|
|||
SSL_COMP_get_compression_methods();
|
||||
|
||||
#ifdef CRYPTO_LOCK
|
||||
l_Mutexes = new boost::mutex[CRYPTO_num_locks()];
|
||||
l_Mutexes = new std::mutex[CRYPTO_num_locks()];
|
||||
CRYPTO_set_locking_callback(&OpenSSLLockingCallback);
|
||||
CRYPTO_set_id_callback(&OpenSSLIDCallback);
|
||||
#endif /* CRYPTO_LOCK */
|
||||
|
@ -816,7 +816,7 @@ String RandomString(int length)
|
|||
/* Ensure that password generation is atomic. RAND_bytes is not thread-safe
|
||||
* in OpenSSL < 1.1.0.
|
||||
*/
|
||||
boost::mutex::scoped_lock lock(l_RandomMutex);
|
||||
std::unique_lock<std::mutex> lock(l_RandomMutex);
|
||||
|
||||
if (!RAND_bytes(bytes, length)) {
|
||||
delete [] bytes;
|
||||
|
|
|
@ -44,16 +44,16 @@ String WorkQueue::GetName() const
|
|||
return m_Name;
|
||||
}
|
||||
|
||||
boost::mutex::scoped_lock WorkQueue::AcquireLock()
|
||||
std::unique_lock<std::mutex> WorkQueue::AcquireLock()
|
||||
{
|
||||
return boost::mutex::scoped_lock(m_Mutex);
|
||||
return std::unique_lock<std::mutex>(m_Mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues a task. Tasks are guaranteed to be executed in the order
|
||||
* they were enqueued in except if there is more than one worker thread.
|
||||
*/
|
||||
void WorkQueue::EnqueueUnlocked(boost::mutex::scoped_lock& lock, std::function<void ()>&& function, WorkQueuePriority priority)
|
||||
void WorkQueue::EnqueueUnlocked(std::unique_lock<std::mutex>& lock, std::function<void ()>&& function, WorkQueuePriority priority)
|
||||
{
|
||||
if (!m_Spawned) {
|
||||
Log(LogNotice, "WorkQueue")
|
||||
|
@ -107,7 +107,7 @@ void WorkQueue::Enqueue(std::function<void ()>&& function, WorkQueuePriority pri
|
|||
*/
|
||||
void WorkQueue::Join(bool stop)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
while (m_Processing || !m_Tasks.empty())
|
||||
m_CVStarved.wait(lock);
|
||||
|
@ -153,7 +153,7 @@ void WorkQueue::SetExceptionCallback(const ExceptionCallback& callback)
|
|||
*/
|
||||
bool WorkQueue::HasExceptions() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
return !m_Exceptions.empty();
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ bool WorkQueue::HasExceptions() const
|
|||
*/
|
||||
std::vector<boost::exception_ptr> WorkQueue::GetExceptions() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
return m_Exceptions;
|
||||
}
|
||||
|
@ -184,14 +184,14 @@ void WorkQueue::ReportExceptions(const String& facility, bool verbose) const
|
|||
|
||||
size_t WorkQueue::GetLength() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
return m_Tasks.size();
|
||||
}
|
||||
|
||||
void WorkQueue::StatusTimerHandler()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
ASSERT(!m_Name.IsEmpty());
|
||||
|
||||
|
@ -238,7 +238,7 @@ void WorkQueue::RunTaskFunction(const TaskFunction& func)
|
|||
boost::exception_ptr eptr = boost::current_exception();
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock mutex(m_Mutex);
|
||||
std::unique_lock<std::mutex> mutex(m_Mutex);
|
||||
|
||||
if (!m_ExceptionCallback)
|
||||
m_Exceptions.push_back(eptr);
|
||||
|
@ -257,7 +257,7 @@ void WorkQueue::WorkerThreadProc()
|
|||
|
||||
l_ThreadWorkQueue.reset(new WorkQueue *(this));
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
for (;;) {
|
||||
while (m_Tasks.empty() && !m_Stopped)
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#include "base/ringbuffer.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
#include <boost/exception_ptr.hpp>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <deque>
|
||||
#include <atomic>
|
||||
|
@ -59,8 +59,8 @@ public:
|
|||
void SetName(const String& name);
|
||||
String GetName() const;
|
||||
|
||||
boost::mutex::scoped_lock AcquireLock();
|
||||
void EnqueueUnlocked(boost::mutex::scoped_lock& lock, TaskFunction&& function, WorkQueuePriority priority = PriorityNormal);
|
||||
std::unique_lock<std::mutex> AcquireLock();
|
||||
void EnqueueUnlocked(std::unique_lock<std::mutex>& lock, TaskFunction&& function, WorkQueuePriority priority = PriorityNormal);
|
||||
void Enqueue(TaskFunction&& function, WorkQueuePriority priority = PriorityNormal,
|
||||
bool allowInterleaved = false);
|
||||
void Join(bool stop = false);
|
||||
|
@ -116,10 +116,10 @@ private:
|
|||
int m_ThreadCount;
|
||||
bool m_Spawned{false};
|
||||
|
||||
mutable boost::mutex m_Mutex;
|
||||
boost::condition_variable m_CVEmpty;
|
||||
boost::condition_variable m_CVFull;
|
||||
boost::condition_variable m_CVStarved;
|
||||
mutable std::mutex m_Mutex;
|
||||
std::condition_variable m_CVEmpty;
|
||||
std::condition_variable m_CVFull;
|
||||
std::condition_variable m_CVStarved;
|
||||
boost::thread_group m_Threads;
|
||||
size_t m_MaxItems;
|
||||
bool m_Stopped{false};
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "base/exception.hpp"
|
||||
#include "base/convert.hpp"
|
||||
#include "base/statsfunction.hpp"
|
||||
#include <chrono>
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
|
@ -69,7 +70,7 @@ void CheckerComponent::Start(bool runtimeCreated)
|
|||
void CheckerComponent::Stop(bool runtimeRemoved)
|
||||
{
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
m_Stopped = true;
|
||||
m_CV.notify_all();
|
||||
}
|
||||
|
@ -88,7 +89,7 @@ void CheckerComponent::CheckThreadProc()
|
|||
Utility::SetThreadName("Check Scheduler");
|
||||
IcingaApplication::Ptr icingaApp = IcingaApplication::GetInstance();
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
for (;;) {
|
||||
typedef boost::multi_index::nth_index<CheckableSet, 1>::type CheckTimeView;
|
||||
|
@ -116,7 +117,7 @@ void CheckerComponent::CheckThreadProc()
|
|||
|
||||
if (wait > 0) {
|
||||
/* Wait for the next check. */
|
||||
m_CV.timed_wait(lock, boost::posix_time::milliseconds(long(wait * 1000)));
|
||||
m_CV.wait_for(lock, std::chrono::duration<double>(wait));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -229,7 +230,7 @@ void CheckerComponent::ExecuteCheckHelper(const Checkable::Ptr& checkable)
|
|||
Checkable::DecreasePendingChecks();
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
/* remove the object from the list of pending objects; if it's not in the
|
||||
* list this was a manual (i.e. forced) check and we must not re-add the
|
||||
|
@ -255,7 +256,7 @@ void CheckerComponent::ResultTimerHandler()
|
|||
std::ostringstream msgbuf;
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
msgbuf << "Pending checkables: " << m_PendingCheckables.size() << "; Idle checkables: " << m_IdleCheckables.size() << "; Checks/s: "
|
||||
<< (CIB::GetActiveHostChecksStatistics(60) + CIB::GetActiveServiceChecksStatistics(60)) / 60.0;
|
||||
|
@ -275,7 +276,7 @@ void CheckerComponent::ObjectHandler(const ConfigObject::Ptr& object)
|
|||
bool same_zone = (!zone || Zone::GetLocalZone() == zone);
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
if (object->IsActive() && !object->IsPaused() && same_zone) {
|
||||
if (m_PendingCheckables.find(checkable) != m_PendingCheckables.end())
|
||||
|
@ -301,7 +302,7 @@ CheckableScheduleInfo CheckerComponent::GetCheckableScheduleInfo(const Checkable
|
|||
|
||||
void CheckerComponent::NextCheckChangedHandler(const Checkable::Ptr& checkable)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
/* remove and re-insert the object from the set in order to force an index update */
|
||||
typedef boost::multi_index::nth_index<CheckableSet, 0>::type CheckableView;
|
||||
|
@ -322,14 +323,14 @@ void CheckerComponent::NextCheckChangedHandler(const Checkable::Ptr& checkable)
|
|||
|
||||
unsigned long CheckerComponent::GetIdleCheckables()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
return m_IdleCheckables.size();
|
||||
}
|
||||
|
||||
unsigned long CheckerComponent::GetPendingCheckables()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
return m_PendingCheckables.size();
|
||||
}
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
#include "base/configobject.hpp"
|
||||
#include "base/timer.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
#include <boost/multi_index/key_extractors.hpp>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
namespace icinga
|
||||
|
@ -69,8 +69,8 @@ public:
|
|||
unsigned long GetPendingCheckables();
|
||||
|
||||
private:
|
||||
boost::mutex m_Mutex;
|
||||
boost::condition_variable m_CV;
|
||||
std::mutex m_Mutex;
|
||||
std::condition_variable m_CV;
|
||||
bool m_Stopped{false};
|
||||
std::thread m_Thread;
|
||||
|
||||
|
|
|
@ -95,9 +95,9 @@ bool CLICommand::IsDeprecated() const
|
|||
return false;
|
||||
}
|
||||
|
||||
boost::mutex& CLICommand::GetRegistryMutex()
|
||||
std::mutex& CLICommand::GetRegistryMutex()
|
||||
{
|
||||
static boost::mutex mtx;
|
||||
static std::mutex mtx;
|
||||
return mtx;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ std::map<std::vector<String>, CLICommand::Ptr>& CLICommand::GetRegistry()
|
|||
|
||||
CLICommand::Ptr CLICommand::GetByName(const std::vector<String>& name)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetRegistryMutex());
|
||||
std::unique_lock<std::mutex> lock(GetRegistryMutex());
|
||||
|
||||
auto it = GetRegistry().find(name);
|
||||
|
||||
|
@ -121,13 +121,13 @@ CLICommand::Ptr CLICommand::GetByName(const std::vector<String>& name)
|
|||
|
||||
void CLICommand::Register(const std::vector<String>& name, const CLICommand::Ptr& function)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetRegistryMutex());
|
||||
std::unique_lock<std::mutex> lock(GetRegistryMutex());
|
||||
GetRegistry()[name] = function;
|
||||
}
|
||||
|
||||
void CLICommand::Unregister(const std::vector<String>& name)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetRegistryMutex());
|
||||
std::unique_lock<std::mutex> lock(GetRegistryMutex());
|
||||
GetRegistry().erase(name);
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ bool CLICommand::ParseCommand(int argc, char **argv, po::options_description& vi
|
|||
po::positional_options_description& positionalDesc,
|
||||
po::variables_map& vm, String& cmdname, CLICommand::Ptr& command, bool autocomplete)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetRegistryMutex());
|
||||
std::unique_lock<std::mutex> lock(GetRegistryMutex());
|
||||
|
||||
typedef std::map<std::vector<String>, CLICommand::Ptr>::value_type CLIKeyValue;
|
||||
|
||||
|
@ -224,7 +224,7 @@ void CLICommand::ShowCommands(int argc, char **argv, po::options_description *vi
|
|||
ArgumentCompletionCallback globalArgCompletionCallback,
|
||||
bool autocomplete, int autoindex)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetRegistryMutex());
|
||||
std::unique_lock<std::mutex> lock(GetRegistryMutex());
|
||||
|
||||
typedef std::map<std::vector<String>, CLICommand::Ptr>::value_type CLIKeyValue;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
bool autocomplete = false, int autoindex = -1);
|
||||
|
||||
private:
|
||||
static boost::mutex& GetRegistryMutex();
|
||||
static std::mutex& GetRegistryMutex();
|
||||
static std::map<std::vector<String>, CLICommand::Ptr>& GetRegistry();
|
||||
};
|
||||
|
||||
|
|
|
@ -117,8 +117,8 @@ extern "C" void dbg_eval_with_object(Object *object, const char *text)
|
|||
|
||||
void ConsoleCommand::BreakpointHandler(ScriptFrame& frame, ScriptError *ex, const DebugInfo& di)
|
||||
{
|
||||
static boost::mutex mutex;
|
||||
boost::mutex::scoped_lock lock(mutex);
|
||||
static std::mutex mutex;
|
||||
std::unique_lock<std::mutex> lock(mutex);
|
||||
|
||||
if (!Application::GetScriptDebuggerEnabled())
|
||||
return;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "base/scriptframe.hpp"
|
||||
#include "base/tlsstream.hpp"
|
||||
#include "remote/url.hpp"
|
||||
#include <condition_variable>
|
||||
|
||||
|
||||
namespace icinga
|
||||
|
@ -37,8 +38,8 @@ public:
|
|||
bool syntaxOnly = false);
|
||||
|
||||
private:
|
||||
mutable boost::mutex m_Mutex;
|
||||
mutable boost::condition_variable m_CV;
|
||||
mutable std::mutex m_Mutex;
|
||||
mutable std::condition_variable m_CV;
|
||||
|
||||
static Shared<AsioTlsStream>::Ptr Connect();
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
using namespace icinga;
|
||||
|
||||
std::vector<String> ConfigCompiler::m_IncludeSearchDirs;
|
||||
boost::mutex ConfigCompiler::m_ZoneDirsMutex;
|
||||
std::mutex ConfigCompiler::m_ZoneDirsMutex;
|
||||
std::map<String, std::vector<ZoneFragment> > ConfigCompiler::m_ZoneDirs;
|
||||
|
||||
/**
|
||||
|
@ -296,7 +296,7 @@ void ConfigCompiler::AddIncludeSearchDir(const String& dir)
|
|||
|
||||
std::vector<ZoneFragment> ConfigCompiler::GetZoneDirs(const String& zone)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ZoneDirsMutex);
|
||||
std::unique_lock<std::mutex> lock(m_ZoneDirsMutex);
|
||||
auto it = m_ZoneDirs.find(zone);
|
||||
if (it == m_ZoneDirs.end())
|
||||
return std::vector<ZoneFragment>();
|
||||
|
@ -310,7 +310,7 @@ void ConfigCompiler::RegisterZoneDir(const String& tag, const String& ppath, con
|
|||
zf.Tag = tag;
|
||||
zf.Path = ppath;
|
||||
|
||||
boost::mutex::scoped_lock lock(m_ZoneDirsMutex);
|
||||
std::unique_lock<std::mutex> lock(m_ZoneDirsMutex);
|
||||
m_ZoneDirs[zoneName].push_back(zf);
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ private:
|
|||
void *m_Scanner;
|
||||
|
||||
static std::vector<String> m_IncludeSearchDirs;
|
||||
static boost::mutex m_ZoneDirsMutex;
|
||||
static std::mutex m_ZoneDirsMutex;
|
||||
static std::map<String, std::vector<ZoneFragment> > m_ZoneDirs;
|
||||
|
||||
void InitializeScanner();
|
||||
|
|
|
@ -41,7 +41,7 @@ void ConfigCompilerContext::WriteObject(const Dictionary::Ptr& object)
|
|||
String json = JsonEncode(object);
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
NetString::WriteStringToStream(*m_ObjectsFP, json);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
#include "config/i2-config.hpp"
|
||||
#include "base/dictionary.hpp"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <fstream>
|
||||
#include <mutex>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ private:
|
|||
String m_ObjectsTempFile;
|
||||
std::fstream *m_ObjectsFP{nullptr};
|
||||
|
||||
mutable boost::mutex m_Mutex;
|
||||
mutable std::mutex m_Mutex;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
boost::mutex ConfigItem::m_Mutex;
|
||||
std::mutex ConfigItem::m_Mutex;
|
||||
ConfigItem::TypeMap ConfigItem::m_Items;
|
||||
ConfigItem::TypeMap ConfigItem::m_DefaultTemplates;
|
||||
ConfigItem::ItemList ConfigItem::m_UnnamedItems;
|
||||
|
@ -195,7 +195,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
|
|||
<< "Ignoring config object '" << m_Name << "' of type '" << type->GetName() << "' due to errors: " << DiagnosticInformation(ex);
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
m_IgnoredItems.push_back(m_DebugInfo.Path);
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
|
|||
<< "Ignoring config object '" << m_Name << "' of type '" << type->GetName() << "' due to errors: " << DiagnosticInformation(ex);
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
m_IgnoredItems.push_back(m_DebugInfo.Path);
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
|
|||
<< "Ignoring config object '" << m_Name << "' of type '" << m_Type->GetName() << "' due to errors: " << DiagnosticInformation(ex);
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
m_IgnoredItems.push_back(m_DebugInfo.Path);
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ void ConfigItem::Register()
|
|||
{
|
||||
m_ActivationContext = ActivationContext::GetCurrentContext();
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
/* If this is a non-abstract object with a composite name
|
||||
* we register it in m_UnnamedItems instead of m_Items. */
|
||||
|
@ -353,7 +353,7 @@ void ConfigItem::Unregister()
|
|||
m_Object.reset();
|
||||
}
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
m_UnnamedItems.erase(std::remove(m_UnnamedItems.begin(), m_UnnamedItems.end(), this), m_UnnamedItems.end());
|
||||
m_Items[m_Type].erase(m_Name);
|
||||
m_DefaultTemplates[m_Type].erase(m_Name);
|
||||
|
@ -368,7 +368,7 @@ void ConfigItem::Unregister()
|
|||
*/
|
||||
ConfigItem::Ptr ConfigItem::GetByTypeAndName(const Type::Ptr& type, const String& name)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
auto it = m_Items.find(type);
|
||||
|
||||
|
@ -389,7 +389,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||
std::vector<ItemPair> items;
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
for (const TypeMap::value_type& kv : m_Items) {
|
||||
for (const ItemMap::value_type& kv2 : kv.second) {
|
||||
|
@ -534,7 +534,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||
item->Unregister();
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(item->m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(item->m_Mutex);
|
||||
item->m_IgnoredItems.push_back(item->m_DebugInfo.Path);
|
||||
}
|
||||
}
|
||||
|
@ -627,8 +627,8 @@ bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& u
|
|||
bool ConfigItem::ActivateItems(const std::vector<ConfigItem::Ptr>& newItems, bool runtimeCreated,
|
||||
bool silent, bool withModAttrs, const Value& cookie)
|
||||
{
|
||||
static boost::mutex mtx;
|
||||
boost::mutex::scoped_lock lock(mtx);
|
||||
static std::mutex mtx;
|
||||
std::unique_lock<std::mutex> lock(mtx);
|
||||
|
||||
if (withModAttrs) {
|
||||
/* restore modified attributes */
|
||||
|
@ -730,7 +730,7 @@ std::vector<ConfigItem::Ptr> ConfigItem::GetItems(const Type::Ptr& type)
|
|||
{
|
||||
std::vector<ConfigItem::Ptr> items;
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
auto it = m_Items.find(type);
|
||||
|
||||
|
@ -750,7 +750,7 @@ std::vector<ConfigItem::Ptr> ConfigItem::GetDefaultTemplates(const Type::Ptr& ty
|
|||
{
|
||||
std::vector<ConfigItem::Ptr> items;
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
auto it = m_DefaultTemplates.find(type);
|
||||
|
||||
|
@ -768,7 +768,7 @@ std::vector<ConfigItem::Ptr> ConfigItem::GetDefaultTemplates(const Type::Ptr& ty
|
|||
|
||||
void ConfigItem::RemoveIgnoredItems(const String& allowedConfigPath)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
for (const String& path : m_IgnoredItems) {
|
||||
if (path.Find(allowedConfigPath) == String::NPos)
|
||||
|
|
|
@ -80,7 +80,7 @@ private:
|
|||
|
||||
ConfigObject::Ptr m_Object;
|
||||
|
||||
static boost::mutex m_Mutex;
|
||||
static std::mutex m_Mutex;
|
||||
|
||||
typedef std::map<String, ConfigItem::Ptr> ItemMap;
|
||||
typedef std::map<Type::Ptr, ItemMap> TypeMap;
|
||||
|
|
|
@ -522,13 +522,13 @@ void DbConnection::IncreaseQueryCount()
|
|||
{
|
||||
double now = Utility::GetTime();
|
||||
|
||||
boost::mutex::scoped_lock lock(m_StatsMutex);
|
||||
std::unique_lock<std::mutex> lock(m_StatsMutex);
|
||||
m_QueryStats.InsertValue(now, 1);
|
||||
}
|
||||
|
||||
int DbConnection::GetQueryCount(RingBuffer::SizeType span)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_StatsMutex);
|
||||
std::unique_lock<std::mutex> lock(m_StatsMutex);
|
||||
return m_QueryStats.UpdateAndGetValues(Utility::GetTime(), span);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "base/timer.hpp"
|
||||
#include "base/ringbuffer.hpp"
|
||||
#include <boost/thread/once.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <mutex>
|
||||
|
||||
#define IDO_CURRENT_SCHEMA_VERSION "1.14.3"
|
||||
#define IDO_COMPAT_SCHEMA_VERSION "1.14.3"
|
||||
|
@ -118,7 +118,7 @@ private:
|
|||
|
||||
static void InsertRuntimeVariable(const String& key, const Value& value);
|
||||
|
||||
mutable boost::mutex m_StatsMutex;
|
||||
mutable std::mutex m_StatsMutex;
|
||||
RingBuffer m_QueryStats{15 * 60};
|
||||
bool m_ActiveChangedHandler{false};
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ void DbObject::OnStatusUpdate()
|
|||
|
||||
DbObject::Ptr DbObject::GetOrCreateByObject(const ConfigObject::Ptr& object)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||
std::unique_lock<std::mutex> lock(GetStaticMutex());
|
||||
|
||||
DbObject::Ptr dbobj = object->GetExtension("DbObject");
|
||||
|
||||
|
@ -422,8 +422,8 @@ void DbObject::VersionChangedHandler(const ConfigObject::Ptr& object)
|
|||
}
|
||||
}
|
||||
|
||||
boost::mutex& DbObject::GetStaticMutex()
|
||||
std::mutex& DbObject::GetStaticMutex()
|
||||
{
|
||||
static boost::mutex mutex;
|
||||
static std::mutex mutex;
|
||||
return mutex;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ private:
|
|||
static void VarsChangedHandler(const CustomVarObject::Ptr& object);
|
||||
static void VersionChangedHandler(const ConfigObject::Ptr& object);
|
||||
|
||||
static boost::mutex& GetStaticMutex();
|
||||
static std::mutex& GetStaticMutex();
|
||||
|
||||
friend class DbType;
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@ String DbType::GetIDColumn() const
|
|||
|
||||
void DbType::RegisterType(const DbType::Ptr& type)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||
std::unique_lock<std::mutex> lock(GetStaticMutex());
|
||||
GetTypes()[type->GetName()] = type;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ DbType::Ptr DbType::GetByName(const String& name)
|
|||
else
|
||||
typeName = name;
|
||||
|
||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||
std::unique_lock<std::mutex> lock(GetStaticMutex());
|
||||
auto it = GetTypes().find(typeName);
|
||||
|
||||
if (it == GetTypes().end())
|
||||
|
@ -58,7 +58,7 @@ DbType::Ptr DbType::GetByName(const String& name)
|
|||
|
||||
DbType::Ptr DbType::GetByID(long tid)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||
std::unique_lock<std::mutex> lock(GetStaticMutex());
|
||||
|
||||
for (const TypeMap::value_type& kv : GetTypes()) {
|
||||
if (kv.second->GetTypeID() == tid)
|
||||
|
@ -105,9 +105,9 @@ DbObject::Ptr DbType::GetOrCreateObjectByName(const String& name1, const String&
|
|||
return dbobj;
|
||||
}
|
||||
|
||||
boost::mutex& DbType::GetStaticMutex()
|
||||
std::mutex& DbType::GetStaticMutex()
|
||||
{
|
||||
static boost::mutex mutex;
|
||||
static std::mutex mutex;
|
||||
return mutex;
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ std::set<DbType::Ptr> DbType::GetAllTypes()
|
|||
std::set<DbType::Ptr> result;
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||
std::unique_lock<std::mutex> lock(GetStaticMutex());
|
||||
for (const auto& kv : GetTypes()) {
|
||||
result.insert(kv.second);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ private:
|
|||
String m_IDColumn;
|
||||
ObjectFactory m_ObjectFactory;
|
||||
|
||||
static boost::mutex& GetStaticMutex();
|
||||
static std::mutex& GetStaticMutex();
|
||||
static TypeMap& GetTypes();
|
||||
|
||||
ObjectMap m_Objects;
|
||||
|
|
|
@ -25,9 +25,9 @@ boost::signals2::signal<void (const Checkable::Ptr&)> Checkable::OnNextCheckUpda
|
|||
|
||||
Atomic<uint_fast64_t> Checkable::CurrentConcurrentChecks (0);
|
||||
|
||||
boost::mutex Checkable::m_StatsMutex;
|
||||
std::mutex Checkable::m_StatsMutex;
|
||||
int Checkable::m_PendingChecks = 0;
|
||||
boost::condition_variable Checkable::m_PendingChecksCV;
|
||||
std::condition_variable Checkable::m_PendingChecksCV;
|
||||
|
||||
CheckCommand::Ptr Checkable::GetCheckCommand() const
|
||||
{
|
||||
|
@ -659,26 +659,26 @@ void Checkable::UpdateStatistics(const CheckResult::Ptr& cr, CheckableType type)
|
|||
|
||||
void Checkable::IncreasePendingChecks()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_StatsMutex);
|
||||
std::unique_lock<std::mutex> lock(m_StatsMutex);
|
||||
m_PendingChecks++;
|
||||
}
|
||||
|
||||
void Checkable::DecreasePendingChecks()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_StatsMutex);
|
||||
std::unique_lock<std::mutex> lock(m_StatsMutex);
|
||||
m_PendingChecks--;
|
||||
m_PendingChecksCV.notify_one();
|
||||
}
|
||||
|
||||
int Checkable::GetPendingChecks()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_StatsMutex);
|
||||
std::unique_lock<std::mutex> lock(m_StatsMutex);
|
||||
return m_PendingChecks;
|
||||
}
|
||||
|
||||
void Checkable::AquirePendingCheckSlot(int maxPendingChecks)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_StatsMutex);
|
||||
std::unique_lock<std::mutex> lock(m_StatsMutex);
|
||||
while (m_PendingChecks >= maxPendingChecks)
|
||||
m_PendingChecksCV.wait(lock);
|
||||
|
||||
|
|
|
@ -38,18 +38,18 @@ void Checkable::RemoveCommentsByType(int type, const String& removedBy)
|
|||
|
||||
std::set<Comment::Ptr> Checkable::GetComments() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_CommentMutex);
|
||||
std::unique_lock<std::mutex> lock(m_CommentMutex);
|
||||
return m_Comments;
|
||||
}
|
||||
|
||||
void Checkable::RegisterComment(const Comment::Ptr& comment)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_CommentMutex);
|
||||
std::unique_lock<std::mutex> lock(m_CommentMutex);
|
||||
m_Comments.insert(comment);
|
||||
}
|
||||
|
||||
void Checkable::UnregisterComment(const Comment::Ptr& comment)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_CommentMutex);
|
||||
std::unique_lock<std::mutex> lock(m_CommentMutex);
|
||||
m_Comments.erase(comment);
|
||||
}
|
||||
|
|
|
@ -8,37 +8,37 @@ using namespace icinga;
|
|||
|
||||
void Checkable::AddDependency(const Dependency::Ptr& dep)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_DependencyMutex);
|
||||
std::unique_lock<std::mutex> lock(m_DependencyMutex);
|
||||
m_Dependencies.insert(dep);
|
||||
}
|
||||
|
||||
void Checkable::RemoveDependency(const Dependency::Ptr& dep)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_DependencyMutex);
|
||||
std::unique_lock<std::mutex> lock(m_DependencyMutex);
|
||||
m_Dependencies.erase(dep);
|
||||
}
|
||||
|
||||
std::vector<Dependency::Ptr> Checkable::GetDependencies() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_DependencyMutex);
|
||||
std::unique_lock<std::mutex> lock(m_DependencyMutex);
|
||||
return std::vector<Dependency::Ptr>(m_Dependencies.begin(), m_Dependencies.end());
|
||||
}
|
||||
|
||||
void Checkable::AddReverseDependency(const Dependency::Ptr& dep)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_DependencyMutex);
|
||||
std::unique_lock<std::mutex> lock(m_DependencyMutex);
|
||||
m_ReverseDependencies.insert(dep);
|
||||
}
|
||||
|
||||
void Checkable::RemoveReverseDependency(const Dependency::Ptr& dep)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_DependencyMutex);
|
||||
std::unique_lock<std::mutex> lock(m_DependencyMutex);
|
||||
m_ReverseDependencies.erase(dep);
|
||||
}
|
||||
|
||||
std::vector<Dependency::Ptr> Checkable::GetReverseDependencies() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_DependencyMutex);
|
||||
std::unique_lock<std::mutex> lock(m_DependencyMutex);
|
||||
return std::vector<Dependency::Ptr>(m_ReverseDependencies.begin(), m_ReverseDependencies.end());
|
||||
}
|
||||
|
||||
|
|
|
@ -47,18 +47,18 @@ int Checkable::GetDowntimeDepth() const
|
|||
|
||||
std::set<Downtime::Ptr> Checkable::GetDowntimes() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_DowntimeMutex);
|
||||
std::unique_lock<std::mutex> lock(m_DowntimeMutex);
|
||||
return m_Downtimes;
|
||||
}
|
||||
|
||||
void Checkable::RegisterDowntime(const Downtime::Ptr& downtime)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_DowntimeMutex);
|
||||
std::unique_lock<std::mutex> lock(m_DowntimeMutex);
|
||||
m_Downtimes.insert(downtime);
|
||||
}
|
||||
|
||||
void Checkable::UnregisterDowntime(const Downtime::Ptr& downtime)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_DowntimeMutex);
|
||||
std::unique_lock<std::mutex> lock(m_DowntimeMutex);
|
||||
m_Downtimes.erase(downtime);
|
||||
}
|
||||
|
|
|
@ -113,19 +113,19 @@ void Checkable::SendNotifications(NotificationType type, const CheckResult::Ptr&
|
|||
|
||||
std::set<Notification::Ptr> Checkable::GetNotifications() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_NotificationMutex);
|
||||
std::unique_lock<std::mutex> lock(m_NotificationMutex);
|
||||
return m_Notifications;
|
||||
}
|
||||
|
||||
void Checkable::RegisterNotification(const Notification::Ptr& notification)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_NotificationMutex);
|
||||
std::unique_lock<std::mutex> lock(m_NotificationMutex);
|
||||
m_Notifications.insert(notification);
|
||||
}
|
||||
|
||||
void Checkable::UnregisterNotification(const Notification::Ptr& notification)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_NotificationMutex);
|
||||
std::unique_lock<std::mutex> lock(m_NotificationMutex);
|
||||
m_Notifications.erase(notification);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ void Checkable::Start(bool runtimeCreated)
|
|||
|
||||
void Checkable::AddGroup(const String& name)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_CheckableMutex);
|
||||
std::unique_lock<std::mutex> lock(m_CheckableMutex);
|
||||
|
||||
Array::Ptr groups;
|
||||
auto *host = dynamic_cast<Host *>(this);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "icinga/downtime.hpp"
|
||||
#include "remote/endpoint.hpp"
|
||||
#include "remote/messageorigin.hpp"
|
||||
#include <condition_variable>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
|
@ -189,17 +190,17 @@ protected:
|
|||
void OnAllConfigLoaded() override;
|
||||
|
||||
private:
|
||||
mutable boost::mutex m_CheckableMutex;
|
||||
mutable std::mutex m_CheckableMutex;
|
||||
bool m_CheckRunning{false};
|
||||
long m_SchedulingOffset;
|
||||
|
||||
static boost::mutex m_StatsMutex;
|
||||
static std::mutex m_StatsMutex;
|
||||
static int m_PendingChecks;
|
||||
static boost::condition_variable m_PendingChecksCV;
|
||||
static std::condition_variable m_PendingChecksCV;
|
||||
|
||||
/* Downtimes */
|
||||
std::set<Downtime::Ptr> m_Downtimes;
|
||||
mutable boost::mutex m_DowntimeMutex;
|
||||
mutable std::mutex m_DowntimeMutex;
|
||||
|
||||
static void NotifyFixedDowntimeStart(const Downtime::Ptr& downtime);
|
||||
static void NotifyFlexibleDowntimeStart(const Downtime::Ptr& downtime);
|
||||
|
@ -212,14 +213,14 @@ private:
|
|||
|
||||
/* Comments */
|
||||
std::set<Comment::Ptr> m_Comments;
|
||||
mutable boost::mutex m_CommentMutex;
|
||||
mutable std::mutex m_CommentMutex;
|
||||
|
||||
/* Notifications */
|
||||
std::set<Notification::Ptr> m_Notifications;
|
||||
mutable boost::mutex m_NotificationMutex;
|
||||
mutable std::mutex m_NotificationMutex;
|
||||
|
||||
/* Dependencies */
|
||||
mutable boost::mutex m_DependencyMutex;
|
||||
mutable std::mutex m_DependencyMutex;
|
||||
std::set<intrusive_ptr<Dependency> > m_Dependencies;
|
||||
std::set<intrusive_ptr<Dependency> > m_ReverseDependencies;
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
private:
|
||||
CIB();
|
||||
|
||||
static boost::mutex m_Mutex;
|
||||
static std::mutex m_Mutex;
|
||||
static RingBuffer m_ActiveHostChecksStatistics;
|
||||
static RingBuffer m_PassiveHostChecksStatistics;
|
||||
static RingBuffer m_ActiveServiceChecksStatistics;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
boost::mutex ClusterEvents::m_Mutex;
|
||||
std::mutex ClusterEvents::m_Mutex;
|
||||
std::deque<std::function<void ()>> ClusterEvents::m_CheckRequestQueue;
|
||||
bool ClusterEvents::m_CheckSchedulerRunning;
|
||||
int ClusterEvents::m_ChecksExecutedDuringInterval;
|
||||
|
@ -25,7 +25,7 @@ void ClusterEvents::RemoteCheckThreadProc()
|
|||
|
||||
int maxConcurrentChecks = IcingaApplication::GetInstance()->GetMaxConcurrentChecks();
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
for(;;) {
|
||||
if (m_CheckRequestQueue.empty())
|
||||
|
@ -60,7 +60,7 @@ void ClusterEvents::EnqueueCheck(const MessageOrigin::Ptr& origin, const Diction
|
|||
m_LogTimer->Start();
|
||||
});
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
if (m_CheckRequestQueue.size() >= 25000) {
|
||||
m_ChecksDroppedDuringInterval++;
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
static void LogRemoteCheckQueueInformation();
|
||||
|
||||
private:
|
||||
static boost::mutex m_Mutex;
|
||||
static std::mutex m_Mutex;
|
||||
static std::deque<std::function<void ()>> m_CheckRequestQueue;
|
||||
static bool m_CheckSchedulerRunning;
|
||||
static int m_ChecksExecutedDuringInterval;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
using namespace icinga;
|
||||
|
||||
static int l_NextCommentID = 1;
|
||||
static boost::mutex l_CommentMutex;
|
||||
static std::mutex l_CommentMutex;
|
||||
static std::map<int, String> l_LegacyCommentsCache;
|
||||
static Timer::Ptr l_CommentsExpireTimer;
|
||||
|
||||
|
@ -87,7 +87,7 @@ void Comment::Start(bool runtimeCreated)
|
|||
});
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_CommentMutex);
|
||||
std::unique_lock<std::mutex> lock(l_CommentMutex);
|
||||
|
||||
SetLegacyId(l_NextCommentID);
|
||||
l_LegacyCommentsCache[l_NextCommentID] = GetName();
|
||||
|
@ -124,7 +124,7 @@ bool Comment::IsExpired() const
|
|||
|
||||
int Comment::GetNextCommentID()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_CommentMutex);
|
||||
std::unique_lock<std::mutex> lock(l_CommentMutex);
|
||||
|
||||
return l_NextCommentID;
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ void Comment::RemoveComment(const String& id, const MessageOrigin::Ptr& origin)
|
|||
|
||||
String Comment::GetCommentIDFromLegacyID(int id)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_CommentMutex);
|
||||
std::unique_lock<std::mutex> lock(l_CommentMutex);
|
||||
|
||||
auto it = l_LegacyCommentsCache.find(id);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
using namespace icinga;
|
||||
|
||||
static int l_NextDowntimeID = 1;
|
||||
static boost::mutex l_DowntimeMutex;
|
||||
static std::mutex l_DowntimeMutex;
|
||||
static std::map<int, String> l_LegacyDowntimesCache;
|
||||
static Timer::Ptr l_DowntimesExpireTimer;
|
||||
static Timer::Ptr l_DowntimesStartTimer;
|
||||
|
@ -103,7 +103,7 @@ void Downtime::Start(bool runtimeCreated)
|
|||
});
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_DowntimeMutex);
|
||||
std::unique_lock<std::mutex> lock(l_DowntimeMutex);
|
||||
|
||||
SetLegacyId(l_NextDowntimeID);
|
||||
l_LegacyDowntimesCache[l_NextDowntimeID] = GetName();
|
||||
|
@ -201,7 +201,7 @@ bool Downtime::HasValidConfigOwner() const
|
|||
|
||||
int Downtime::GetNextDowntimeID()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_DowntimeMutex);
|
||||
std::unique_lock<std::mutex> lock(l_DowntimeMutex);
|
||||
|
||||
return l_NextDowntimeID;
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ void Downtime::TriggerDowntime()
|
|||
|
||||
String Downtime::GetDowntimeIDFromLegacyID(int id)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_DowntimeMutex);
|
||||
std::unique_lock<std::mutex> lock(l_DowntimeMutex);
|
||||
|
||||
auto it = l_LegacyDowntimesCache.find(id);
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ void ExternalCommandProcessor::Execute(double time, const String& command, const
|
|||
});
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetMutex());
|
||||
std::unique_lock<std::mutex> lock(GetMutex());
|
||||
|
||||
auto it = GetCommands().find(command);
|
||||
|
||||
|
@ -107,7 +107,7 @@ void ExternalCommandProcessor::Execute(double time, const String& command, const
|
|||
|
||||
void ExternalCommandProcessor::RegisterCommand(const String& command, const ExternalCommandCallback& callback, size_t minArgs, size_t maxArgs)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetMutex());
|
||||
std::unique_lock<std::mutex> lock(GetMutex());
|
||||
ExternalCommandInfo eci;
|
||||
eci.Callback = callback;
|
||||
eci.MinArgs = minArgs;
|
||||
|
@ -2267,9 +2267,9 @@ void ExternalCommandProcessor::DisableServicegroupSvcNotifications(double, const
|
|||
}
|
||||
}
|
||||
|
||||
boost::mutex& ExternalCommandProcessor::GetMutex()
|
||||
std::mutex& ExternalCommandProcessor::GetMutex()
|
||||
{
|
||||
static boost::mutex mtx;
|
||||
static std::mutex mtx;
|
||||
return mtx;
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ private:
|
|||
static void RegisterCommand(const String& command, const ExternalCommandCallback& callback, size_t minArgs = 0, size_t maxArgs = UINT_MAX);
|
||||
static void RegisterCommands();
|
||||
|
||||
static boost::mutex& GetMutex();
|
||||
static std::mutex& GetMutex();
|
||||
static std::map<String, ExternalCommandInfo>& GetCommands();
|
||||
|
||||
};
|
||||
|
|
|
@ -84,7 +84,7 @@ void Host::Stop(bool runtimeRemoved)
|
|||
|
||||
std::vector<Service::Ptr> Host::GetServices() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ServicesMutex);
|
||||
std::unique_lock<std::mutex> lock(m_ServicesMutex);
|
||||
|
||||
std::vector<Service::Ptr> services;
|
||||
services.reserve(m_Services.size());
|
||||
|
@ -98,14 +98,14 @@ std::vector<Service::Ptr> Host::GetServices() const
|
|||
|
||||
void Host::AddService(const Service::Ptr& service)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ServicesMutex);
|
||||
std::unique_lock<std::mutex> lock(m_ServicesMutex);
|
||||
|
||||
m_Services[service->GetShortName()] = service;
|
||||
}
|
||||
|
||||
void Host::RemoveService(const Service::Ptr& service)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ServicesMutex);
|
||||
std::unique_lock<std::mutex> lock(m_ServicesMutex);
|
||||
|
||||
m_Services.erase(service->GetShortName());
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ Service::Ptr Host::GetServiceByShortName(const Value& name)
|
|||
{
|
||||
if (name.IsScalar()) {
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ServicesMutex);
|
||||
std::unique_lock<std::mutex> lock(m_ServicesMutex);
|
||||
|
||||
auto it = m_Services.find(name);
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ protected:
|
|||
void CreateChildObjects(const Type::Ptr& childType) override;
|
||||
|
||||
private:
|
||||
mutable boost::mutex m_ServicesMutex;
|
||||
mutable std::mutex m_ServicesMutex;
|
||||
std::map<String, intrusive_ptr<Service> > m_Services;
|
||||
|
||||
static void RefreshServicesCache();
|
||||
|
|
|
@ -58,7 +58,7 @@ void HostGroup::EvaluateObjectRules(const Host::Ptr& host)
|
|||
|
||||
std::set<Host::Ptr> HostGroup::GetMembers() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_HostGroupMutex);
|
||||
std::unique_lock<std::mutex> lock(m_HostGroupMutex);
|
||||
return m_Members;
|
||||
}
|
||||
|
||||
|
@ -66,13 +66,13 @@ void HostGroup::AddMember(const Host::Ptr& host)
|
|||
{
|
||||
host->AddGroup(GetName());
|
||||
|
||||
boost::mutex::scoped_lock lock(m_HostGroupMutex);
|
||||
std::unique_lock<std::mutex> lock(m_HostGroupMutex);
|
||||
m_Members.insert(host);
|
||||
}
|
||||
|
||||
void HostGroup::RemoveMember(const Host::Ptr& host)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_HostGroupMutex);
|
||||
std::unique_lock<std::mutex> lock(m_HostGroupMutex);
|
||||
m_Members.erase(host);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
static void EvaluateObjectRules(const Host::Ptr& host);
|
||||
|
||||
private:
|
||||
mutable boost::mutex m_HostGroupMutex;
|
||||
mutable std::mutex m_HostGroupMutex;
|
||||
std::set<Host::Ptr> m_Members;
|
||||
|
||||
static bool EvaluateObjectRule(const Host::Ptr& host, const intrusive_ptr<ConfigItem>& item);
|
||||
|
|
|
@ -61,7 +61,7 @@ void ServiceGroup::EvaluateObjectRules(const Service::Ptr& service)
|
|||
|
||||
std::set<Service::Ptr> ServiceGroup::GetMembers() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ServiceGroupMutex);
|
||||
std::unique_lock<std::mutex> lock(m_ServiceGroupMutex);
|
||||
return m_Members;
|
||||
}
|
||||
|
||||
|
@ -69,13 +69,13 @@ void ServiceGroup::AddMember(const Service::Ptr& service)
|
|||
{
|
||||
service->AddGroup(GetName());
|
||||
|
||||
boost::mutex::scoped_lock lock(m_ServiceGroupMutex);
|
||||
std::unique_lock<std::mutex> lock(m_ServiceGroupMutex);
|
||||
m_Members.insert(service);
|
||||
}
|
||||
|
||||
void ServiceGroup::RemoveMember(const Service::Ptr& service)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ServiceGroupMutex);
|
||||
std::unique_lock<std::mutex> lock(m_ServiceGroupMutex);
|
||||
m_Members.erase(service);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
static void EvaluateObjectRules(const Service::Ptr& service);
|
||||
|
||||
private:
|
||||
mutable boost::mutex m_ServiceGroupMutex;
|
||||
mutable std::mutex m_ServiceGroupMutex;
|
||||
std::set<Service::Ptr> m_Members;
|
||||
|
||||
static bool EvaluateObjectRule(const Service::Ptr& service, const intrusive_ptr<ConfigItem>& group);
|
||||
|
|
|
@ -62,7 +62,7 @@ void User::Stop(bool runtimeRemoved)
|
|||
|
||||
void User::AddGroup(const String& name)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_UserMutex);
|
||||
std::unique_lock<std::mutex> lock(m_UserMutex);
|
||||
|
||||
Array::Ptr groups = GetGroups();
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ protected:
|
|||
void OnConfigLoaded() override;
|
||||
void OnAllConfigLoaded() override;
|
||||
private:
|
||||
mutable boost::mutex m_UserMutex;
|
||||
mutable std::mutex m_UserMutex;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ void UserGroup::EvaluateObjectRules(const User::Ptr& user)
|
|||
|
||||
std::set<User::Ptr> UserGroup::GetMembers() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_UserGroupMutex);
|
||||
std::unique_lock<std::mutex> lock(m_UserGroupMutex);
|
||||
return m_Members;
|
||||
}
|
||||
|
||||
|
@ -66,13 +66,13 @@ void UserGroup::AddMember(const User::Ptr& user)
|
|||
{
|
||||
user->AddGroup(GetName());
|
||||
|
||||
boost::mutex::scoped_lock lock(m_UserGroupMutex);
|
||||
std::unique_lock<std::mutex> lock(m_UserGroupMutex);
|
||||
m_Members.insert(user);
|
||||
}
|
||||
|
||||
void UserGroup::RemoveMember(const User::Ptr& user)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_UserGroupMutex);
|
||||
std::unique_lock<std::mutex> lock(m_UserGroupMutex);
|
||||
m_Members.erase(user);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
static void EvaluateObjectRules(const User::Ptr& user);
|
||||
|
||||
private:
|
||||
mutable boost::mutex m_UserGroupMutex;
|
||||
mutable std::mutex m_UserGroupMutex;
|
||||
std::set<User::Ptr> m_Members;
|
||||
|
||||
static bool EvaluateObjectRule(const User::Ptr& user, const intrusive_ptr<ConfigItem>& group);
|
||||
|
|
|
@ -22,7 +22,7 @@ REGISTER_TYPE(LivestatusListener);
|
|||
|
||||
static int l_ClientsConnected = 0;
|
||||
static int l_Connections = 0;
|
||||
static boost::mutex l_ComponentMutex;
|
||||
static std::mutex l_ComponentMutex;
|
||||
|
||||
REGISTER_STATSFUNCTION(LivestatusListener, &LivestatusListener::StatsFunc);
|
||||
|
||||
|
@ -119,14 +119,14 @@ void LivestatusListener::Stop(bool runtimeRemoved)
|
|||
|
||||
int LivestatusListener::GetClientsConnected()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_ComponentMutex);
|
||||
std::unique_lock<std::mutex> lock(l_ComponentMutex);
|
||||
|
||||
return l_ClientsConnected;
|
||||
}
|
||||
|
||||
int LivestatusListener::GetConnections()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_ComponentMutex);
|
||||
std::unique_lock<std::mutex> lock(l_ComponentMutex);
|
||||
|
||||
return l_Connections;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void LivestatusListener::ServerThreadProc()
|
|||
void LivestatusListener::ClientHandler(const Socket::Ptr& client)
|
||||
{
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_ComponentMutex);
|
||||
std::unique_lock<std::mutex> lock(l_ComponentMutex);
|
||||
l_ClientsConnected++;
|
||||
l_Connections++;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ void LivestatusListener::ClientHandler(const Socket::Ptr& client)
|
|||
}
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_ComponentMutex);
|
||||
std::unique_lock<std::mutex> lock(l_ComponentMutex);
|
||||
l_ClientsConnected--;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
using namespace icinga;
|
||||
|
||||
static int l_ExternalCommands = 0;
|
||||
static boost::mutex l_QueryMutex;
|
||||
static std::mutex l_QueryMutex;
|
||||
|
||||
LivestatusQuery::LivestatusQuery(const std::vector<String>& lines, const String& compat_log_path)
|
||||
: m_KeepAlive(false), m_OutputFormat("csv"), m_ColumnHeaders(true), m_Limit(-1), m_ErrorCode(0),
|
||||
|
@ -260,7 +260,7 @@ LivestatusQuery::LivestatusQuery(const std::vector<String>& lines, const String&
|
|||
|
||||
int LivestatusQuery::GetExternalCommands()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_QueryMutex);
|
||||
std::unique_lock<std::mutex> lock(l_QueryMutex);
|
||||
|
||||
return l_ExternalCommands;
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ void LivestatusQuery::ExecuteGetHelper(const Stream::Ptr& stream)
|
|||
void LivestatusQuery::ExecuteCommandHelper(const Stream::Ptr& stream)
|
||||
{
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_QueryMutex);
|
||||
std::unique_lock<std::mutex> lock(l_QueryMutex);
|
||||
|
||||
l_ExternalCommands++;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#define LOGTABLE_H
|
||||
|
||||
#include "livestatus/historytable.hpp"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include "icinga/service.hpp"
|
||||
#include "livestatus/historytable.hpp"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ void ElasticsearchWriter::Enqueue(const Checkable::Ptr& checkable, const String&
|
|||
const Dictionary::Ptr& fields, double ts)
|
||||
{
|
||||
/* Atomically buffer the data point. */
|
||||
boost::mutex::scoped_lock lock(m_DataBufferMutex);
|
||||
std::unique_lock<std::mutex> lock(m_DataBufferMutex);
|
||||
|
||||
/* Format the timestamps to dynamically select the date datatype inside the index. */
|
||||
fields->Set("@timestamp", FormatTimestamp(ts));
|
||||
|
@ -398,7 +398,7 @@ void ElasticsearchWriter::FlushTimeout()
|
|||
/* Prevent new data points from being added to the array, there is a
|
||||
* race condition where they could disappear.
|
||||
*/
|
||||
boost::mutex::scoped_lock lock(m_DataBufferMutex);
|
||||
std::unique_lock<std::mutex> lock(m_DataBufferMutex);
|
||||
|
||||
/* Flush if there are any data available. */
|
||||
if (m_DataBuffer.size() > 0) {
|
||||
|
|
|
@ -33,7 +33,7 @@ private:
|
|||
WorkQueue m_WorkQueue{10000000, 1};
|
||||
Timer::Ptr m_FlushTimer;
|
||||
std::vector<String> m_DataBuffer;
|
||||
boost::mutex m_DataBufferMutex;
|
||||
std::mutex m_DataBufferMutex;
|
||||
|
||||
void AddCheckResult(const Dictionary::Ptr& fields, const Checkable::Ptr& checkable, const CheckResult::Ptr& cr);
|
||||
|
||||
|
|
|
@ -398,7 +398,7 @@ void GraphiteWriter::SendMetric(const Checkable::Ptr& checkable, const String& p
|
|||
// do not send \n to debug log
|
||||
msgbuf << "\n";
|
||||
|
||||
boost::mutex::scoped_lock lock(m_StreamMutex);
|
||||
std::unique_lock<std::mutex> lock(m_StreamMutex);
|
||||
|
||||
if (!GetConnected())
|
||||
return;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "base/timer.hpp"
|
||||
#include "base/workqueue.hpp"
|
||||
#include <fstream>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <mutex>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ protected:
|
|||
|
||||
private:
|
||||
Shared<AsioTcpStream>::Ptr m_Stream;
|
||||
boost::mutex m_StreamMutex;
|
||||
std::mutex m_StreamMutex;
|
||||
WorkQueue m_WorkQueue{10000000, 1};
|
||||
|
||||
Timer::Ptr m_ReconnectTimer;
|
||||
|
|
|
@ -118,7 +118,7 @@ void PerfdataWriter::CheckResultHandler(const Checkable::Ptr& checkable, const C
|
|||
String line = MacroProcessor::ResolveMacros(GetServiceFormatTemplate(), resolvers, cr, nullptr, &PerfdataWriter::EscapeMacroMetric);
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_StreamMutex);
|
||||
std::unique_lock<std::mutex> lock(m_StreamMutex);
|
||||
|
||||
if (!m_ServiceOutputFile.good())
|
||||
return;
|
||||
|
@ -129,7 +129,7 @@ void PerfdataWriter::CheckResultHandler(const Checkable::Ptr& checkable, const C
|
|||
String line = MacroProcessor::ResolveMacros(GetHostFormatTemplate(), resolvers, cr, nullptr, &PerfdataWriter::EscapeMacroMetric);
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_StreamMutex);
|
||||
std::unique_lock<std::mutex> lock(m_StreamMutex);
|
||||
|
||||
if (!m_HostOutputFile.good())
|
||||
return;
|
||||
|
@ -144,7 +144,7 @@ void PerfdataWriter::RotateFile(std::ofstream& output, const String& temp_path,
|
|||
Log(LogDebug, "PerfdataWriter")
|
||||
<< "Rotating perfdata files.";
|
||||
|
||||
boost::mutex::scoped_lock lock(m_StreamMutex);
|
||||
std::unique_lock<std::mutex> lock(m_StreamMutex);
|
||||
|
||||
if (output.good()) {
|
||||
output.close();
|
||||
|
|
|
@ -37,7 +37,7 @@ private:
|
|||
Timer::Ptr m_RotationTimer;
|
||||
std::ofstream m_ServiceOutputFile;
|
||||
std::ofstream m_HostOutputFile;
|
||||
boost::mutex m_StreamMutex;
|
||||
std::mutex m_StreamMutex;
|
||||
|
||||
void CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr);
|
||||
static Value EscapeMacroMetric(const Value& value);
|
||||
|
|
|
@ -252,7 +252,7 @@ void ApiListener::Start(bool runtimeCreated)
|
|||
ObjectImpl<ApiListener>::Start(runtimeCreated);
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_LogLock);
|
||||
std::unique_lock<std::mutex> lock(m_LogLock);
|
||||
OpenLogFile();
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ void ApiListener::Stop(bool runtimeDeleted)
|
|||
<< "'" << GetName() << "' stopped.";
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_LogLock);
|
||||
std::unique_lock<std::mutex> lock(m_LogLock);
|
||||
CloseLogFile();
|
||||
RotateLogFile();
|
||||
}
|
||||
|
@ -1048,7 +1048,7 @@ void ApiListener::PersistMessage(const Dictionary::Ptr& message, const ConfigObj
|
|||
pmessage->Set("secobj", secname);
|
||||
}
|
||||
|
||||
boost::mutex::scoped_lock lock(m_LogLock);
|
||||
std::unique_lock<std::mutex> lock(m_LogLock);
|
||||
if (m_LogFile) {
|
||||
NetString::WriteStringToStream(m_LogFile, JsonEncode(pmessage));
|
||||
m_LogMessageCount++;
|
||||
|
@ -1347,7 +1347,7 @@ void ApiListener::ReplayLog(const JsonRpcConnection::Ptr& client)
|
|||
}
|
||||
|
||||
for (;;) {
|
||||
boost::mutex::scoped_lock lock(m_LogLock);
|
||||
std::unique_lock<std::mutex> lock(m_LogLock);
|
||||
|
||||
CloseLogFile();
|
||||
|
||||
|
@ -1624,7 +1624,7 @@ double ApiListener::CalculateZoneLag(const Endpoint::Ptr& endpoint)
|
|||
|
||||
bool ApiListener::AddAnonymousClient(const JsonRpcConnection::Ptr& aclient)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_AnonymousClientsLock);
|
||||
std::unique_lock<std::mutex> lock(m_AnonymousClientsLock);
|
||||
|
||||
if (GetMaxAnonymousClients() >= 0 && (long)m_AnonymousClients.size() + 1 > (long)GetMaxAnonymousClients())
|
||||
return false;
|
||||
|
@ -1635,31 +1635,31 @@ bool ApiListener::AddAnonymousClient(const JsonRpcConnection::Ptr& aclient)
|
|||
|
||||
void ApiListener::RemoveAnonymousClient(const JsonRpcConnection::Ptr& aclient)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_AnonymousClientsLock);
|
||||
std::unique_lock<std::mutex> lock(m_AnonymousClientsLock);
|
||||
m_AnonymousClients.erase(aclient);
|
||||
}
|
||||
|
||||
std::set<JsonRpcConnection::Ptr> ApiListener::GetAnonymousClients() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_AnonymousClientsLock);
|
||||
std::unique_lock<std::mutex> lock(m_AnonymousClientsLock);
|
||||
return m_AnonymousClients;
|
||||
}
|
||||
|
||||
void ApiListener::AddHttpClient(const HttpServerConnection::Ptr& aclient)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_HttpClientsLock);
|
||||
std::unique_lock<std::mutex> lock(m_HttpClientsLock);
|
||||
m_HttpClients.insert(aclient);
|
||||
}
|
||||
|
||||
void ApiListener::RemoveHttpClient(const HttpServerConnection::Ptr& aclient)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_HttpClientsLock);
|
||||
std::unique_lock<std::mutex> lock(m_HttpClientsLock);
|
||||
m_HttpClients.erase(aclient);
|
||||
}
|
||||
|
||||
std::set<HttpServerConnection::Ptr> ApiListener::GetHttpClients() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_HttpClientsLock);
|
||||
std::unique_lock<std::mutex> lock(m_HttpClientsLock);
|
||||
return m_HttpClients;
|
||||
}
|
||||
|
||||
|
@ -1718,7 +1718,7 @@ Endpoint::Ptr ApiListener::GetLocalEndpoint() const
|
|||
|
||||
void ApiListener::UpdateActivePackageStagesCache()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ActivePackageStagesLock);
|
||||
std::unique_lock<std::mutex> lock(m_ActivePackageStagesLock);
|
||||
|
||||
for (auto package : ConfigPackageUtility::GetPackages()) {
|
||||
String activeStage;
|
||||
|
@ -1740,7 +1740,7 @@ void ApiListener::UpdateActivePackageStagesCache()
|
|||
|
||||
void ApiListener::CheckApiPackageIntegrity()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ActivePackageStagesLock);
|
||||
std::unique_lock<std::mutex> lock(m_ActivePackageStagesLock);
|
||||
|
||||
for (auto package : ConfigPackageUtility::GetPackages()) {
|
||||
String activeStage;
|
||||
|
@ -1766,13 +1766,13 @@ void ApiListener::CheckApiPackageIntegrity()
|
|||
|
||||
void ApiListener::SetActivePackageStage(const String& package, const String& stage)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ActivePackageStagesLock);
|
||||
std::unique_lock<std::mutex> lock(m_ActivePackageStagesLock);
|
||||
m_ActivePackageStages[package] = stage;
|
||||
}
|
||||
|
||||
String ApiListener::GetActivePackageStage(const String& package)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ActivePackageStagesLock);
|
||||
std::unique_lock<std::mutex> lock(m_ActivePackageStagesLock);
|
||||
|
||||
if (m_ActivePackageStages.find(package) == m_ActivePackageStages.end())
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Package " + package + " has no active stage."));
|
||||
|
@ -1783,7 +1783,7 @@ String ApiListener::GetActivePackageStage(const String& package)
|
|||
void ApiListener::RemoveActivePackageStage(const String& package)
|
||||
{
|
||||
/* This is the rare occassion when a package has been deleted. */
|
||||
boost::mutex::scoped_lock lock(m_ActivePackageStagesLock);
|
||||
std::unique_lock<std::mutex> lock(m_ActivePackageStagesLock);
|
||||
|
||||
auto it = m_ActivePackageStages.find(package);
|
||||
|
||||
|
|
|
@ -160,8 +160,8 @@ protected:
|
|||
private:
|
||||
Shared<boost::asio::ssl::context>::Ptr m_SSLContext;
|
||||
|
||||
mutable boost::mutex m_AnonymousClientsLock;
|
||||
mutable boost::mutex m_HttpClientsLock;
|
||||
mutable std::mutex m_AnonymousClientsLock;
|
||||
mutable std::mutex m_HttpClientsLock;
|
||||
std::set<JsonRpcConnection::Ptr> m_AnonymousClients;
|
||||
std::set<HttpServerConnection::Ptr> m_HttpClients;
|
||||
|
||||
|
@ -197,7 +197,7 @@ private:
|
|||
WorkQueue m_RelayQueue;
|
||||
WorkQueue m_SyncQueue{0, 4};
|
||||
|
||||
boost::mutex m_LogLock;
|
||||
std::mutex m_LogLock;
|
||||
Stream::Ptr m_LogFile;
|
||||
size_t m_LogMessageCount{0};
|
||||
|
||||
|
@ -247,7 +247,7 @@ private:
|
|||
void SyncClient(const JsonRpcConnection::Ptr& aclient, const Endpoint::Ptr& endpoint, bool needSync);
|
||||
|
||||
/* API Config Packages */
|
||||
mutable boost::mutex m_ActivePackageStagesLock;
|
||||
mutable std::mutex m_ActivePackageStagesLock;
|
||||
std::map<String, String> m_ActivePackageStages;
|
||||
|
||||
void UpdateActivePackageStagesCache();
|
||||
|
|
|
@ -86,7 +86,7 @@ void ConfigObjectUtility::RepairPackage(const String& package)
|
|||
|
||||
void ConfigObjectUtility::CreateStorage()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(ConfigPackageUtility::GetStaticPackageMutex());
|
||||
std::unique_lock<std::mutex> lock(ConfigPackageUtility::GetStaticPackageMutex());
|
||||
|
||||
/* For now, we only use _api as our creation target. */
|
||||
String package = "_api";
|
||||
|
|
|
@ -63,7 +63,7 @@ void ConfigPackagesHandler::HandleGet(
|
|||
ArrayData results;
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(ConfigPackageUtility::GetStaticPackageMutex());
|
||||
std::unique_lock<std::mutex> lock(ConfigPackageUtility::GetStaticPackageMutex());
|
||||
|
||||
for (const String& package : packages) {
|
||||
String activeStage;
|
||||
|
@ -111,7 +111,7 @@ void ConfigPackagesHandler::HandlePost(
|
|||
}
|
||||
|
||||
try {
|
||||
boost::mutex::scoped_lock lock(ConfigPackageUtility::GetStaticPackageMutex());
|
||||
std::unique_lock<std::mutex> lock(ConfigPackageUtility::GetStaticPackageMutex());
|
||||
|
||||
ConfigPackageUtility::CreatePackage(packageName);
|
||||
} catch (const std::exception& ex) {
|
||||
|
|
|
@ -187,7 +187,7 @@ void ConfigPackageUtility::TryActivateStageCallback(const ProcessResult& pr, con
|
|||
if (pr.ExitStatus == 0) {
|
||||
if (activate) {
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetStaticPackageMutex());
|
||||
std::unique_lock<std::mutex> lock(GetStaticPackageMutex());
|
||||
|
||||
ActivateStage(packageName, stageName);
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ std::vector<String> ConfigPackageUtility::GetStages(const String& packageName)
|
|||
String ConfigPackageUtility::GetActiveStageFromFile(const String& packageName)
|
||||
{
|
||||
/* Lock the transaction, reading this only happens on startup or when something really is broken. */
|
||||
boost::mutex::scoped_lock lock(GetStaticActiveStageMutex());
|
||||
std::unique_lock<std::mutex> lock(GetStaticActiveStageMutex());
|
||||
|
||||
String path = GetPackageDir() + "/" + packageName + "/active-stage";
|
||||
|
||||
|
@ -274,7 +274,7 @@ String ConfigPackageUtility::GetActiveStageFromFile(const String& packageName)
|
|||
|
||||
void ConfigPackageUtility::SetActiveStageToFile(const String& packageName, const String& stageName)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetStaticActiveStageMutex());
|
||||
std::unique_lock<std::mutex> lock(GetStaticActiveStageMutex());
|
||||
|
||||
String activeStagePath = GetPackageDir() + "/" + packageName + "/active-stage";
|
||||
|
||||
|
@ -384,14 +384,14 @@ bool ConfigPackageUtility::ValidateName(const String& name)
|
|||
return (!boost::regex_search(name.GetData(), what, expr));
|
||||
}
|
||||
|
||||
boost::mutex& ConfigPackageUtility::GetStaticPackageMutex()
|
||||
std::mutex& ConfigPackageUtility::GetStaticPackageMutex()
|
||||
{
|
||||
static boost::mutex mutex;
|
||||
static std::mutex mutex;
|
||||
return mutex;
|
||||
}
|
||||
|
||||
boost::mutex& ConfigPackageUtility::GetStaticActiveStageMutex()
|
||||
std::mutex& ConfigPackageUtility::GetStaticActiveStageMutex()
|
||||
{
|
||||
static boost::mutex mutex;
|
||||
static std::mutex mutex;
|
||||
return mutex;
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ public:
|
|||
static bool ContainsDotDot(const String& path);
|
||||
static bool ValidateName(const String& name);
|
||||
|
||||
static boost::mutex& GetStaticPackageMutex();
|
||||
static boost::mutex& GetStaticActiveStageMutex();
|
||||
static std::mutex& GetStaticPackageMutex();
|
||||
static std::mutex& GetStaticActiveStageMutex();
|
||||
|
||||
private:
|
||||
static void CollectDirNames(const String& path, std::vector<String>& dirs);
|
||||
|
|
|
@ -128,7 +128,7 @@ void ConfigStagesHandler::HandlePost(
|
|||
if (reload && !activate)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Parameter 'reload' must be false when 'activate' is false."));
|
||||
|
||||
boost::mutex::scoped_lock lock(ConfigPackageUtility::GetStaticPackageMutex());
|
||||
std::unique_lock<std::mutex> lock(ConfigPackageUtility::GetStaticPackageMutex());
|
||||
|
||||
stageName = ConfigPackageUtility::CreateStage(packageName, files);
|
||||
|
||||
|
|
|
@ -20,14 +20,14 @@ using namespace icinga;
|
|||
|
||||
REGISTER_URLHANDLER("/v1/console", ConsoleHandler);
|
||||
|
||||
static boost::mutex l_QueryMutex;
|
||||
static std::mutex l_QueryMutex;
|
||||
static std::map<String, ApiScriptFrame> l_ApiScriptFrames;
|
||||
static Timer::Ptr l_FrameCleanupTimer;
|
||||
static boost::mutex l_ApiScriptMutex;
|
||||
static std::mutex l_ApiScriptMutex;
|
||||
|
||||
static void ScriptFrameCleanupHandler()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_ApiScriptMutex);
|
||||
std::unique_lock<std::mutex> lock(l_ApiScriptMutex);
|
||||
|
||||
std::vector<String> cleanup_keys;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ void Endpoint::AddClient(const JsonRpcConnection::Ptr& client)
|
|||
bool was_master = ApiListener::GetInstance()->IsMaster();
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ClientsLock);
|
||||
std::unique_lock<std::mutex> lock(m_ClientsLock);
|
||||
m_Clients.insert(client);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ void Endpoint::RemoveClient(const JsonRpcConnection::Ptr& client)
|
|||
bool was_master = ApiListener::GetInstance()->IsMaster();
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ClientsLock);
|
||||
std::unique_lock<std::mutex> lock(m_ClientsLock);
|
||||
m_Clients.erase(client);
|
||||
|
||||
Log(LogWarning, "ApiListener")
|
||||
|
@ -76,7 +76,7 @@ void Endpoint::RemoveClient(const JsonRpcConnection::Ptr& client)
|
|||
|
||||
std::set<JsonRpcConnection::Ptr> Endpoint::GetClients() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ClientsLock);
|
||||
std::unique_lock<std::mutex> lock(m_ClientsLock);
|
||||
return m_Clients;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ Zone::Ptr Endpoint::GetZone() const
|
|||
|
||||
bool Endpoint::GetConnected() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ClientsLock);
|
||||
std::unique_lock<std::mutex> lock(m_ClientsLock);
|
||||
return !m_Clients.empty();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ protected:
|
|||
void OnAllConfigLoaded() override;
|
||||
|
||||
private:
|
||||
mutable boost::mutex m_ClientsLock;
|
||||
mutable std::mutex m_ClientsLock;
|
||||
std::set<intrusive_ptr<JsonRpcConnection> > m_Clients;
|
||||
intrusive_ptr<Zone> m_Zone;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <boost/date_time/posix_time/posix_time_duration.hpp>
|
||||
#include <boost/date_time/posix_time/ptime.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <chrono>
|
||||
#include <utility>
|
||||
|
||||
using namespace icinga;
|
||||
|
@ -21,7 +22,7 @@ EventQueue::EventQueue(String name)
|
|||
|
||||
bool EventQueue::CanProcessEvent(const String& type) const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
return m_Types.find(type) != m_Types.end();
|
||||
}
|
||||
|
@ -41,7 +42,7 @@ void EventQueue::ProcessEvent(const Dictionary::Ptr& event)
|
|||
return;
|
||||
}
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
typedef std::pair<void *const, std::deque<Dictionary::Ptr> > kv_pair;
|
||||
for (kv_pair& kv : m_Events) {
|
||||
|
@ -53,7 +54,7 @@ void EventQueue::ProcessEvent(const Dictionary::Ptr& event)
|
|||
|
||||
void EventQueue::AddClient(void *client)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
auto result = m_Events.insert(std::make_pair(client, std::deque<Dictionary::Ptr>()));
|
||||
ASSERT(result.second);
|
||||
|
@ -65,14 +66,14 @@ void EventQueue::AddClient(void *client)
|
|||
|
||||
void EventQueue::RemoveClient(void *client)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
m_Events.erase(client);
|
||||
}
|
||||
|
||||
void EventQueue::UnregisterIfUnused(const String& name, const EventQueue::Ptr& queue)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(queue->m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(queue->m_Mutex);
|
||||
|
||||
if (queue->m_Events.empty())
|
||||
Unregister(name);
|
||||
|
@ -80,19 +81,19 @@ void EventQueue::UnregisterIfUnused(const String& name, const EventQueue::Ptr& q
|
|||
|
||||
void EventQueue::SetTypes(const std::set<String>& types)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
m_Types = types;
|
||||
}
|
||||
|
||||
void EventQueue::SetFilter(std::unique_ptr<Expression> filter)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
m_Filter.swap(filter);
|
||||
}
|
||||
|
||||
Dictionary::Ptr EventQueue::WaitForEvent(void *client, double timeout)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
|
||||
for (;;) {
|
||||
auto it = m_Events.find(client);
|
||||
|
@ -104,7 +105,7 @@ Dictionary::Ptr EventQueue::WaitForEvent(void *client, double timeout)
|
|||
return result;
|
||||
}
|
||||
|
||||
if (!m_CV.timed_wait(lock, boost::posix_time::milliseconds(long(timeout * 1000))))
|
||||
if (m_CV.wait_for(lock, std::chrono::duration<double>(timeout)) == std::cv_status::timeout)
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
#include "config/expression.hpp"
|
||||
#include <boost/asio/deadline_timer.hpp>
|
||||
#include <boost/asio/spawn.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
#include <condition_variable>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <mutex>
|
||||
|
@ -48,8 +47,8 @@ public:
|
|||
private:
|
||||
String m_Name;
|
||||
|
||||
mutable boost::mutex m_Mutex;
|
||||
boost::condition_variable m_CV;
|
||||
mutable std::mutex m_Mutex;
|
||||
std::condition_variable m_CV;
|
||||
|
||||
std::set<String> m_Types;
|
||||
std::unique_ptr<Expression> m_Filter;
|
||||
|
|
Loading…
Reference in New Issue