summaryrefslogtreecommitdiff
path: root/src/mongo/logv2
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/logv2')
-rw-r--r--src/mongo/logv2/console.h2
-rw-r--r--src/mongo/logv2/log_component_settings.cpp4
-rw-r--r--src/mongo/logv2/log_component_settings.h4
-rw-r--r--src/mongo/logv2/logv2_bm.cpp8
-rw-r--r--src/mongo/logv2/ramlog.cpp6
-rw-r--r--src/mongo/logv2/ramlog.h5
6 files changed, 15 insertions, 14 deletions
diff --git a/src/mongo/logv2/console.h b/src/mongo/logv2/console.h
index 5e8abc00521..061ad77cf05 100644
--- a/src/mongo/logv2/console.h
+++ b/src/mongo/logv2/console.h
@@ -31,7 +31,7 @@
#include <iosfwd>
-#include "mongo/stdx/mutex.h"
+#include "mongo/platform/mutex.h"
namespace mongo {
namespace logv2 {
diff --git a/src/mongo/logv2/log_component_settings.cpp b/src/mongo/logv2/log_component_settings.cpp
index 0003dfcbe8d..c85d33c8487 100644
--- a/src/mongo/logv2/log_component_settings.cpp
+++ b/src/mongo/logv2/log_component_settings.cpp
@@ -61,7 +61,7 @@ LogSeverity LogComponentSettings::getMinimumLogSeverity(LogComponent component)
void LogComponentSettings::setMinimumLoggedSeverity(LogComponent component, LogSeverity severity) {
dassert(int(component) >= 0 && int(component) < LogComponent::kNumLogComponents);
- stdx::lock_guard<stdx::mutex> lk(_mtx);
+ stdx::lock_guard<Latch> lk(_mtx);
_setMinimumLoggedSeverityInLock(component, severity);
}
@@ -99,7 +99,7 @@ void LogComponentSettings::_setMinimumLoggedSeverityInLock(LogComponent componen
void LogComponentSettings::clearMinimumLoggedSeverity(LogComponent component) {
dassert(int(component) >= 0 && int(component) < LogComponent::kNumLogComponents);
- stdx::lock_guard<stdx::mutex> lk(_mtx);
+ stdx::lock_guard<Latch> lk(_mtx);
// LogComponent::kDefault must always be configured.
if (component == LogComponent::kDefault) {
diff --git a/src/mongo/logv2/log_component_settings.h b/src/mongo/logv2/log_component_settings.h
index c9422786132..72e0b00358c 100644
--- a/src/mongo/logv2/log_component_settings.h
+++ b/src/mongo/logv2/log_component_settings.h
@@ -32,7 +32,7 @@
#include "mongo/logv2/log_component.h"
#include "mongo/logv2/log_severity.h"
#include "mongo/platform/atomic_word.h"
-#include "mongo/stdx/mutex.h"
+#include "mongo/platform/mutex.h"
namespace mongo {
namespace logv2 {
@@ -87,7 +87,7 @@ private:
// A mutex to synchronize writes to the severity arrays. This mutex is to synchronize changes to
// the entire array, and the atomics are to synchronize individual elements.
- stdx::mutex _mtx;
+ Mutex _mtx = MONGO_MAKE_LATCH("LogComponentSettings::_mtx");
// True if a log severity is explicitly set for a component.
// This differentiates between unconfigured components and components that happen to have
diff --git a/src/mongo/logv2/logv2_bm.cpp b/src/mongo/logv2/logv2_bm.cpp
index 73958db80f8..1b29b84164d 100644
--- a/src/mongo/logv2/logv2_bm.cpp
+++ b/src/mongo/logv2/logv2_bm.cpp
@@ -61,13 +61,13 @@ boost::shared_ptr<std::ostream> makeNullStream() {
// ConsoleAppender can be benchmarked.
class StringstreamConsole {
public:
- stdx::mutex& mutex() {
- static stdx::mutex instance;
+ Mutex& mutex() {
+ static auto instance = MONGO_MAKE_LATCH();
return instance;
}
StringstreamConsole() {
- stdx::unique_lock<stdx::mutex> lk(mutex());
+ stdx::unique_lock<Latch> lk(mutex());
lk.swap(_consoleLock);
_out = makeNullStream();
}
@@ -78,7 +78,7 @@ public:
private:
boost::shared_ptr<std::ostream> _out;
- stdx::unique_lock<stdx::mutex> _consoleLock;
+ stdx::unique_lock<Latch> _consoleLock;
};
// RAII style helper class for init/deinit log system
diff --git a/src/mongo/logv2/ramlog.cpp b/src/mongo/logv2/ramlog.cpp
index b14a93b87ca..38076ef1481 100644
--- a/src/mongo/logv2/ramlog.cpp
+++ b/src/mongo/logv2/ramlog.cpp
@@ -43,7 +43,7 @@ using std::string;
namespace {
typedef std::map<string, RamLog*> RM;
-stdx::mutex* _namedLock = NULL;
+stdx::mutex* _namedLock = NULL; // NOLINT
RM* _named = NULL;
} // namespace
@@ -156,7 +156,7 @@ RamLog::LineIterator::LineIterator(RamLog* ramlog)
RamLog* RamLog::get(const std::string& name) {
if (!_namedLock) {
// Guaranteed to happen before multi-threaded operation.
- _namedLock = new stdx::mutex();
+ _namedLock = new stdx::mutex(); // NOLINT
}
stdx::lock_guard<stdx::mutex> lk(*_namedLock);
@@ -201,7 +201,7 @@ MONGO_INITIALIZER(RamLogCatalogV2)(InitializerContext*) {
return Status(ErrorCodes::InternalError,
"Inconsistent intiailization of RamLogCatalog.");
}
- _namedLock = new stdx::mutex();
+ _namedLock = new stdx::mutex(); // NOLINT
_named = new RM();
}
diff --git a/src/mongo/logv2/ramlog.h b/src/mongo/logv2/ramlog.h
index 183464f1c5a..5feba166044 100644
--- a/src/mongo/logv2/ramlog.h
+++ b/src/mongo/logv2/ramlog.h
@@ -36,7 +36,7 @@
#include "mongo/base/status.h"
#include "mongo/base/string_data.h"
-#include "mongo/stdx/mutex.h"
+#include "mongo/platform/mutex.h"
#include "mongo/util/concurrency/mutex.h"
namespace mongo {
@@ -113,7 +113,8 @@ private:
const char* getLine_inlock(unsigned lineNumber) const;
- stdx::mutex _mutex; // Guards all non-static data.
+ // Guards all non-static data.
+ stdx::mutex _mutex; // NOLINT
char lines[N][C];
unsigned h; // current position
unsigned n; // number of lines stores 0 o N