diff options
Diffstat (limited to 'src/mongo/tools')
-rw-r--r-- | src/mongo/tools/bridge.cpp | 6 | ||||
-rw-r--r-- | src/mongo/tools/bridge_commands.cpp | 16 | ||||
-rw-r--r-- | src/mongo/tools/bridge_commands.h | 6 |
3 files changed, 13 insertions, 15 deletions
diff --git a/src/mongo/tools/bridge.cpp b/src/mongo/tools/bridge.cpp index 6f965e01760..a709769cf6f 100644 --- a/src/mongo/tools/bridge.cpp +++ b/src/mongo/tools/bridge.cpp @@ -41,11 +41,11 @@ #include "mongo/db/operation_context.h" #include "mongo/db/service_context.h" #include "mongo/platform/atomic_word.h" +#include "mongo/platform/mutex.h" #include "mongo/platform/random.h" #include "mongo/rpc/factory.h" #include "mongo/rpc/message.h" #include "mongo/rpc/reply_builder_interface.h" -#include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/tools/bridge_commands.h" #include "mongo/tools/mongobridge_options.h" @@ -116,7 +116,7 @@ public: HostSettings getHostSettings(boost::optional<HostAndPort> host) { if (host) { - stdx::lock_guard<stdx::mutex> lk(_settingsMutex); + stdx::lock_guard<Latch> lk(_settingsMutex); return (_settings)[*host]; } return {}; @@ -132,7 +132,7 @@ public: private: static const ServiceContext::Decoration<BridgeContext> _get; - stdx::mutex _settingsMutex; + Mutex _settingsMutex = MONGO_MAKE_LATCH("BridgeContext::_settingsMutex"); HostSettingsMap _settings; }; diff --git a/src/mongo/tools/bridge_commands.cpp b/src/mongo/tools/bridge_commands.cpp index a94153904d4..aa3bc583a15 100644 --- a/src/mongo/tools/bridge_commands.cpp +++ b/src/mongo/tools/bridge_commands.cpp @@ -48,7 +48,7 @@ const char kHostFieldName[] = "host"; class CmdDelayMessagesFrom final : public BridgeCommand { public: - Status run(const BSONObj& cmdObj, stdx::mutex* settingsMutex, HostSettingsMap* settings) final { + Status run(const BSONObj& cmdObj, Mutex* settingsMutex, HostSettingsMap* settings) final { invariant(settingsMutex); invariant(settings); @@ -69,7 +69,7 @@ public: HostAndPort host(hostName); { - stdx::lock_guard<stdx::mutex> lk(*settingsMutex); + stdx::lock_guard<Latch> lk(*settingsMutex); auto& hostSettings = (*settings)[host]; hostSettings.state = HostSettings::State::kForward; hostSettings.delay = Milliseconds{newDelay}; @@ -80,7 +80,7 @@ public: class CmdAcceptConnectionsFrom final : public BridgeCommand { public: - Status run(const BSONObj& cmdObj, stdx::mutex* settingsMutex, HostSettingsMap* settings) final { + Status run(const BSONObj& cmdObj, Mutex* settingsMutex, HostSettingsMap* settings) final { invariant(settingsMutex); invariant(settings); @@ -92,7 +92,7 @@ public: HostAndPort host(hostName); { - stdx::lock_guard<stdx::mutex> lk(*settingsMutex); + stdx::lock_guard<Latch> lk(*settingsMutex); auto& hostSettings = (*settings)[host]; hostSettings.state = HostSettings::State::kForward; } @@ -102,7 +102,7 @@ public: class CmdRejectConnectionsFrom final : public BridgeCommand { public: - Status run(const BSONObj& cmdObj, stdx::mutex* settingsMutex, HostSettingsMap* settings) final { + Status run(const BSONObj& cmdObj, Mutex* settingsMutex, HostSettingsMap* settings) final { invariant(settingsMutex); invariant(settings); @@ -114,7 +114,7 @@ public: HostAndPort host(hostName); { - stdx::lock_guard<stdx::mutex> lk(*settingsMutex); + stdx::lock_guard<Latch> lk(*settingsMutex); auto& hostSettings = (*settings)[host]; hostSettings.state = HostSettings::State::kHangUp; } @@ -124,7 +124,7 @@ public: class CmdDiscardMessagesFrom final : public BridgeCommand { public: - Status run(const BSONObj& cmdObj, stdx::mutex* settingsMutex, HostSettingsMap* settings) final { + Status run(const BSONObj& cmdObj, Mutex* settingsMutex, HostSettingsMap* settings) final { invariant(settingsMutex); invariant(settings); @@ -151,7 +151,7 @@ public: HostAndPort host(hostName); { - stdx::lock_guard<stdx::mutex> lk(*settingsMutex); + stdx::lock_guard<Latch> lk(*settingsMutex); auto& hostSettings = (*settings)[host]; hostSettings.state = HostSettings::State::kDiscard; hostSettings.loss = newLoss; diff --git a/src/mongo/tools/bridge_commands.h b/src/mongo/tools/bridge_commands.h index 1df953a8be4..8b32fbba86c 100644 --- a/src/mongo/tools/bridge_commands.h +++ b/src/mongo/tools/bridge_commands.h @@ -29,7 +29,7 @@ #pragma once -#include "mongo/stdx/mutex.h" +#include "mongo/platform/mutex.h" #include "mongo/stdx/unordered_map.h" #include "mongo/util/time_support.h" @@ -58,9 +58,7 @@ public: virtual ~BridgeCommand() = 0; - virtual Status run(const BSONObj& cmdObj, - stdx::mutex* settingsMutex, - HostSettingsMap* settings) = 0; + virtual Status run(const BSONObj& cmdObj, Mutex* settingsMutex, HostSettingsMap* settings) = 0; }; } // namespace mongo |