summaryrefslogtreecommitdiff
path: root/src/mongo/db/logical_time_validator.cpp
diff options
context:
space:
mode:
authorBen Caimano <ben.caimano@mongodb.com>2019-09-17 23:22:19 +0000
committerevergreen <evergreen@mongodb.com>2019-09-17 23:22:19 +0000
commitbc11369435ca51e2ff6897433d00f6b909f6a25f (patch)
tree251653ec8285d798b41846e343e7e414e80ff277 /src/mongo/db/logical_time_validator.cpp
parent45aea2495306dd61fab46bd398735bb6aaf7b53a (diff)
downloadmongo-bc11369435ca51e2ff6897433d00f6b909f6a25f.tar.gz
SERVER-42165 Replace uses of stdx::mutex with mongo::Mutex
Diffstat (limited to 'src/mongo/db/logical_time_validator.cpp')
-rw-r--r--src/mongo/db/logical_time_validator.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/mongo/db/logical_time_validator.cpp b/src/mongo/db/logical_time_validator.cpp
index 66136950343..df814663ff6 100644
--- a/src/mongo/db/logical_time_validator.cpp
+++ b/src/mongo/db/logical_time_validator.cpp
@@ -51,7 +51,7 @@ namespace {
const auto getLogicalClockValidator =
ServiceContext::declareDecoration<std::unique_ptr<LogicalTimeValidator>>();
-stdx::mutex validatorMutex; // protects access to decoration instance of LogicalTimeValidator.
+Mutex validatorMutex; // protects access to decoration instance of LogicalTimeValidator.
std::vector<Privilege> advanceClusterTimePrivilege;
@@ -67,7 +67,7 @@ Milliseconds kRefreshIntervalIfErrored(200);
} // unnamed namespace
LogicalTimeValidator* LogicalTimeValidator::get(ServiceContext* service) {
- stdx::lock_guard<stdx::mutex> lk(validatorMutex);
+ stdx::lock_guard<Latch> lk(validatorMutex);
return getLogicalClockValidator(service).get();
}
@@ -77,7 +77,7 @@ LogicalTimeValidator* LogicalTimeValidator::get(OperationContext* ctx) {
void LogicalTimeValidator::set(ServiceContext* service,
std::unique_ptr<LogicalTimeValidator> newValidator) {
- stdx::lock_guard<stdx::mutex> lk(validatorMutex);
+ stdx::lock_guard<Latch> lk(validatorMutex);
auto& validator = getLogicalClockValidator(service);
validator = std::move(newValidator);
}
@@ -91,7 +91,7 @@ SignedLogicalTime LogicalTimeValidator::_getProof(const KeysCollectionDocument&
// Compare and calculate HMAC inside mutex to prevent multiple threads computing HMAC for the
// same cluster time.
- stdx::lock_guard<stdx::mutex> lk(_mutex);
+ stdx::lock_guard<Latch> lk(_mutex);
// Note: _lastSeenValidTime will initially not have a proof set.
if (newTime == _lastSeenValidTime.getTime() && _lastSeenValidTime.getProof()) {
return _lastSeenValidTime;
@@ -143,7 +143,7 @@ SignedLogicalTime LogicalTimeValidator::signLogicalTime(OperationContext* opCtx,
Status LogicalTimeValidator::validate(OperationContext* opCtx, const SignedLogicalTime& newTime) {
{
- stdx::lock_guard<stdx::mutex> lk(_mutex);
+ stdx::lock_guard<Latch> lk(_mutex);
if (newTime.getTime() <= _lastSeenValidTime.getTime()) {
return Status::OK();
}
@@ -173,7 +173,7 @@ void LogicalTimeValidator::init(ServiceContext* service) {
}
void LogicalTimeValidator::shutDown() {
- stdx::lock_guard<stdx::mutex> lk(_mutexKeyManager);
+ stdx::lock_guard<Latch> lk(_mutexKeyManager);
if (_keyManager) {
_keyManager->stopMonitoring();
}
@@ -198,23 +198,23 @@ bool LogicalTimeValidator::shouldGossipLogicalTime() {
void LogicalTimeValidator::resetKeyManagerCache() {
log() << "Resetting key manager cache";
{
- stdx::lock_guard<stdx::mutex> keyManagerLock(_mutexKeyManager);
+ stdx::lock_guard<Latch> keyManagerLock(_mutexKeyManager);
invariant(_keyManager);
_keyManager->clearCache();
}
- stdx::lock_guard<stdx::mutex> lk(_mutex);
+ stdx::lock_guard<Latch> lk(_mutex);
_lastSeenValidTime = SignedLogicalTime();
_timeProofService.resetCache();
}
void LogicalTimeValidator::stopKeyManager() {
- stdx::lock_guard<stdx::mutex> keyManagerLock(_mutexKeyManager);
+ stdx::lock_guard<Latch> keyManagerLock(_mutexKeyManager);
if (_keyManager) {
log() << "Stopping key manager";
_keyManager->stopMonitoring();
_keyManager->clearCache();
- stdx::lock_guard<stdx::mutex> lk(_mutex);
+ stdx::lock_guard<Latch> lk(_mutex);
_lastSeenValidTime = SignedLogicalTime();
_timeProofService.resetCache();
} else {
@@ -223,7 +223,7 @@ void LogicalTimeValidator::stopKeyManager() {
}
std::shared_ptr<KeysCollectionManager> LogicalTimeValidator::_getKeyManagerCopy() {
- stdx::lock_guard<stdx::mutex> lk(_mutexKeyManager);
+ stdx::lock_guard<Latch> lk(_mutexKeyManager);
invariant(_keyManager);
return _keyManager;
}