Module: check_mk
Branch: master
Commit: 08e511dfa4b0943e7c99f9b9b8c0684de8f30ae6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=08e511dfa4b094…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Aug 17 10:16:24 2017 +0200
Improved naming and added comments.
Change-Id: I7c0aeebb517f4d00f182bf4a7b703c5d833d878f
---
livestatus/src/ClientQueue.h | 6 ++++--
livestatus/src/Logger.h | 3 +++
livestatus/src/Store.h | 2 ++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/livestatus/src/ClientQueue.h b/livestatus/src/ClientQueue.h
index 455f474..063dc8c 100644
--- a/livestatus/src/ClientQueue.h
+++ b/livestatus/src/ClientQueue.h
@@ -39,10 +39,12 @@ public:
void terminate();
private:
- std::deque<int> _queue;
+ // The mutext protects _queue and _should_terminate, and it works together
+ // with the condition variable.
std::mutex _mutex;
- std::condition_variable _cond;
+ std::deque<int> _queue;
bool _should_terminate;
+ std::condition_variable _cond;
};
#endif // ClientQueue_h
diff --git a/livestatus/src/Logger.h b/livestatus/src/Logger.h
index f5fbf6b..270fec2 100644
--- a/livestatus/src/Logger.h
+++ b/livestatus/src/Logger.h
@@ -121,6 +121,7 @@ public:
SharedStreamHandler(std::mutex &mutex, std::ostream &os);
private:
+ // The mutex protects the _os.
std::mutex &_mutex;
std::ostream &_os;
@@ -132,6 +133,7 @@ public:
explicit StreamHandler(std::ostream &os);
private:
+ // The mutex protects the output stream, see SharedStreamHandler.
std::mutex _mutex;
};
@@ -249,6 +251,7 @@ public:
private:
static LogManager _global_log_manager;
+ // The mutex protects _known_loggers.
std::mutex _mutex;
std::unordered_map<std::string, std::unique_ptr<Logger>> _known_loggers;
diff --git a/livestatus/src/Store.h b/livestatus/src/Store.h
index d6cc658..1365ff5 100644
--- a/livestatus/src/Store.h
+++ b/livestatus/src/Store.h
@@ -136,6 +136,8 @@ private:
std::map<std::string, Table *> _tables;
#ifndef CMC
+ // Nagios is not thread-safe, so this mutex protects calls to
+ // process_external_command1 / submit_external_command.
std::mutex _command_mutex;
#endif