diff options
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r-- | src/mongo/db/commands/dbhash.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/fsync.cpp | 30 | ||||
-rw-r--r-- | src/mongo/db/commands/mr.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/parameters.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/commands/user_management_commands.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/commands/validate.cpp | 6 |
6 files changed, 26 insertions, 26 deletions
diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp index a8ac6e5c022..751ac181371 100644 --- a/src/mongo/db/commands/dbhash.cpp +++ b/src/mongo/db/commands/dbhash.cpp @@ -50,7 +50,7 @@ #include "mongo/db/repl/replication_coordinator.h" #include "mongo/db/storage/storage_engine.h" #include "mongo/db/transaction_participant.h" -#include "mongo/stdx/mutex.h" +#include "mongo/platform/mutex.h" #include "mongo/util/log.h" #include "mongo/util/md5.hpp" #include "mongo/util/net/socket_utils.h" diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp index 66535156467..45fde032004 100644 --- a/src/mongo/db/commands/fsync.cpp +++ b/src/mongo/db/commands/fsync.cpp @@ -49,7 +49,7 @@ #include "mongo/db/service_context.h" #include "mongo/db/storage/backup_cursor_hooks.h" #include "mongo/db/storage/storage_engine.h" -#include "mongo/stdx/condition_variable.h" +#include "mongo/platform/condition_variable.h" #include "mongo/util/assert_util.h" #include "mongo/util/background.h" #include "mongo/util/exit.h" @@ -95,7 +95,7 @@ public: virtual ~FSyncCommand() { // The FSyncLockThread is owned by the FSyncCommand and accesses FsyncCommand state. It must // be shut down prior to FSyncCommand destruction. - stdx::unique_lock<stdx::mutex> lk(lockStateMutex); + stdx::unique_lock<Latch> lk(lockStateMutex); if (_lockCount > 0) { _lockCount = 0; releaseFsyncLockSyncCV.notify_one(); @@ -166,7 +166,7 @@ public: Status status = Status::OK(); { - stdx::unique_lock<stdx::mutex> lk(lockStateMutex); + stdx::unique_lock<Latch> lk(lockStateMutex); threadStatus = Status::OK(); threadStarted = false; _lockThread = std::make_unique<FSyncLockThread>(allowFsyncFailure); @@ -199,13 +199,13 @@ public: // Returns whether we are currently fsyncLocked. For use by callers not holding lockStateMutex. bool fsyncLocked() { - stdx::unique_lock<stdx::mutex> lkFsyncLocked(_fsyncLockedMutex); + stdx::unique_lock<Latch> lkFsyncLocked(_fsyncLockedMutex); return _fsyncLocked; } // For callers not already holding 'lockStateMutex'. int64_t getLockCount() { - stdx::unique_lock<stdx::mutex> lk(lockStateMutex); + stdx::unique_lock<Latch> lk(lockStateMutex); return getLockCount_inLock(); } @@ -215,17 +215,17 @@ public: } void releaseLock() { - stdx::unique_lock<stdx::mutex> lk(lockStateMutex); + stdx::unique_lock<Latch> lk(lockStateMutex); releaseLock_inLock(lk); } - void releaseLock_inLock(stdx::unique_lock<stdx::mutex>& lk) { + void releaseLock_inLock(stdx::unique_lock<Latch>& lk) { invariant(_lockCount >= 1); _lockCount--; if (_lockCount == 0) { { - stdx::unique_lock<stdx::mutex> lkFsyncLocked(_fsyncLockedMutex); + stdx::unique_lock<Latch> lkFsyncLocked(_fsyncLockedMutex); _fsyncLocked = false; } releaseFsyncLockSyncCV.notify_one(); @@ -237,7 +237,7 @@ public: // Allows for control of lock state change between the fsyncLock and fsyncUnlock commands and // the FSyncLockThread that maintains the global read lock. - stdx::mutex lockStateMutex; + Mutex lockStateMutex = MONGO_MAKE_LATCH("FSyncCommand::lockStateMutex"); stdx::condition_variable acquireFsyncLockSyncCV; stdx::condition_variable releaseFsyncLockSyncCV; @@ -248,11 +248,11 @@ public: private: void acquireLock() { - stdx::unique_lock<stdx::mutex> lk(lockStateMutex); + stdx::unique_lock<Latch> lk(lockStateMutex); _lockCount++; if (_lockCount == 1) { - stdx::unique_lock<stdx::mutex> lkFsyncLocked(_fsyncLockedMutex); + stdx::unique_lock<Latch> lkFsyncLocked(_fsyncLockedMutex); _fsyncLocked = true; } } @@ -263,7 +263,7 @@ private: // number is decremented to 0. May only be accessed while 'lockStateMutex' is held. int64_t _lockCount = 0; - stdx::mutex _fsyncLockedMutex; + Mutex _fsyncLockedMutex = MONGO_MAKE_LATCH("FSyncCommand::_fsyncLockedMutex"); bool _fsyncLocked = false; } fsyncCmd; @@ -302,7 +302,7 @@ public: Lock::ExclusiveLock lk(opCtx->lockState(), commandMutex); - stdx::unique_lock<stdx::mutex> stateLock(fsyncCmd.lockStateMutex); + stdx::unique_lock<Latch> stateLock(fsyncCmd.lockStateMutex); auto lockCount = fsyncCmd.getLockCount_inLock(); if (lockCount == 0) { @@ -340,7 +340,7 @@ bool FSyncLockThread::_shutdownTaskRegistered = false; void FSyncLockThread::run() { ThreadClient tc("fsyncLockWorker", getGlobalServiceContext()); stdx::lock_guard<SimpleMutex> lkf(filesLockedFsync); - stdx::unique_lock<stdx::mutex> lk(fsyncCmd.lockStateMutex); + stdx::unique_lock<Latch> lk(fsyncCmd.lockStateMutex); invariant(fsyncCmd.getLockCount_inLock() == 1); @@ -357,7 +357,7 @@ void FSyncLockThread::run() { if (!_shutdownTaskRegistered) { _shutdownTaskRegistered = true; registerShutdownTask([&] { - stdx::unique_lock<stdx::mutex> stateLock(fsyncCmd.lockStateMutex); + stdx::unique_lock<Latch> stateLock(fsyncCmd.lockStateMutex); if (fsyncCmd.getLockCount_inLock() > 0) { warning() << "Interrupting fsync because the server is shutting down."; while (fsyncCmd.getLockCount_inLock()) { diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index 3319caa2fcf..80045f62d90 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -64,6 +64,7 @@ #include "mongo/db/server_options.h" #include "mongo/db/service_context.h" #include "mongo/db/storage/durable_catalog.h" +#include "mongo/platform/mutex.h" #include "mongo/s/catalog_cache.h" #include "mongo/s/client/parallel.h" #include "mongo/s/client/shard_connection.h" @@ -72,7 +73,6 @@ #include "mongo/s/shard_key_pattern.h" #include "mongo/s/stale_exception.h" #include "mongo/scripting/engine.h" -#include "mongo/stdx/mutex.h" #include "mongo/util/debug_util.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" diff --git a/src/mongo/db/commands/parameters.cpp b/src/mongo/db/commands/parameters.cpp index 4f2306ad1b2..625b3aaee76 100644 --- a/src/mongo/db/commands/parameters.cpp +++ b/src/mongo/db/commands/parameters.cpp @@ -185,7 +185,7 @@ Status setLogComponentVerbosity(const BSONObj& bsonSettings) { } // for automationServiceDescription -stdx::mutex autoServiceDescriptorMutex; +Mutex autoServiceDescriptorMutex; std::string autoServiceDescriptorValue; } // namespace @@ -436,7 +436,7 @@ Status LogComponentVerbosityServerParameter::setFromString(const std::string& st void AutomationServiceDescriptorServerParameter::append(OperationContext*, BSONObjBuilder& builder, const std::string& name) { - const stdx::lock_guard<stdx::mutex> lock(autoServiceDescriptorMutex); + const stdx::lock_guard<Latch> lock(autoServiceDescriptorMutex); if (!autoServiceDescriptorValue.empty()) { builder.append(name, autoServiceDescriptorValue); } @@ -458,7 +458,7 @@ Status AutomationServiceDescriptorServerParameter::setFromString(const std::stri << " must be no more than " << kMaxSize << " bytes"}; { - const stdx::lock_guard<stdx::mutex> lock(autoServiceDescriptorMutex); + const stdx::lock_guard<Latch> lock(autoServiceDescriptorMutex); autoServiceDescriptorValue = str; } diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp index ae199964060..90bec146f42 100644 --- a/src/mongo/db/commands/user_management_commands.cpp +++ b/src/mongo/db/commands/user_management_commands.cpp @@ -67,9 +67,9 @@ #include "mongo/db/ops/write_ops.h" #include "mongo/db/query/cursor_response.h" #include "mongo/db/service_context.h" +#include "mongo/platform/mutex.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/s/write_ops/batched_command_response.h" -#include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_set.h" #include "mongo/util/icu.h" #include "mongo/util/log.h" @@ -558,7 +558,7 @@ Status writeAuthSchemaVersionIfNeeded(OperationContext* opCtx, return status; } -auto getUMCMutex = ServiceContext::declareDecoration<stdx::mutex>(); +auto getUMCMutex = ServiceContext::declareDecoration<Mutex>(); class AuthzLockGuard { AuthzLockGuard(AuthzLockGuard&) = delete; @@ -590,7 +590,7 @@ public: private: OperationContext* _opCtx; AuthorizationManager* _authzManager; - stdx::unique_lock<stdx::mutex> _lock; + stdx::unique_lock<Latch> _lock; InvalidationMode _mode; OID _cacheGeneration; }; diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp index f90a3ace4fe..482baff8b74 100644 --- a/src/mongo/db/commands/validate.cpp +++ b/src/mongo/db/commands/validate.cpp @@ -50,7 +50,7 @@ MONGO_FAIL_POINT_DEFINE(validateCmdCollectionNotValid); namespace { // Protects the state below. -stdx::mutex _validationMutex; +Mutex _validationMutex; // Holds the set of full `databaseName.collectionName` namespace strings in progress. Validation // commands register themselves in this data structure so that subsequent commands on the same @@ -140,7 +140,7 @@ public: // Only one validation per collection can be in progress, the rest wait. { - stdx::unique_lock<stdx::mutex> lock(_validationMutex); + stdx::unique_lock<Latch> lock(_validationMutex); try { while (_validationsInProgress.find(nss.ns()) != _validationsInProgress.end()) { opCtx->waitForConditionOrInterrupt(_validationNotifier, lock); @@ -157,7 +157,7 @@ public: } ON_BLOCK_EXIT([&] { - stdx::lock_guard<stdx::mutex> lock(_validationMutex); + stdx::lock_guard<Latch> lock(_validationMutex); _validationsInProgress.erase(nss.ns()); _validationNotifier.notify_all(); }); |