summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/documentsourcetests.cpp6
-rw-r--r--src/mongo/dbtests/framework.cpp2
-rw-r--r--src/mongo/dbtests/mock/mock_conn_registry.cpp8
-rw-r--r--src/mongo/dbtests/mock/mock_conn_registry.h2
-rw-r--r--src/mongo/dbtests/threadedtests.cpp6
5 files changed, 12 insertions, 12 deletions
diff --git a/src/mongo/dbtests/documentsourcetests.cpp b/src/mongo/dbtests/documentsourcetests.cpp
index daba3a54f84..8963c988bfd 100644
--- a/src/mongo/dbtests/documentsourcetests.cpp
+++ b/src/mongo/dbtests/documentsourcetests.cpp
@@ -199,12 +199,12 @@ class PendingValue {
public:
PendingValue(int initialValue) : _value(initialValue) {}
void set(int newValue) {
- stdx::lock_guard<stdx::mutex> lk(_mutex);
+ stdx::lock_guard<Latch> lk(_mutex);
_value = newValue;
_condition.notify_all();
}
void await(int expectedValue) const {
- stdx::unique_lock<stdx::mutex> lk(_mutex);
+ stdx::unique_lock<Latch> lk(_mutex);
while (_value != expectedValue) {
_condition.wait(lk);
}
@@ -212,7 +212,7 @@ public:
private:
int _value;
- mutable stdx::mutex _mutex;
+ mutable Mutex _mutex = MONGO_MAKE_LATCH("PendingValue::_mutex");
mutable stdx::condition_variable _condition;
};
diff --git a/src/mongo/dbtests/framework.cpp b/src/mongo/dbtests/framework.cpp
index c0f09bbf48b..d06d92ae4aa 100644
--- a/src/mongo/dbtests/framework.cpp
+++ b/src/mongo/dbtests/framework.cpp
@@ -51,9 +51,9 @@
#include "mongo/db/storage/storage_engine_init.h"
#include "mongo/dbtests/dbtests.h"
#include "mongo/dbtests/framework_options.h"
+#include "mongo/platform/mutex.h"
#include "mongo/scripting/dbdirectclient_factory.h"
#include "mongo/scripting/engine.h"
-#include "mongo/stdx/mutex.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/exit.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/dbtests/mock/mock_conn_registry.cpp b/src/mongo/dbtests/mock/mock_conn_registry.cpp
index 9faf584bb10..1c9e52b018f 100644
--- a/src/mongo/dbtests/mock/mock_conn_registry.cpp
+++ b/src/mongo/dbtests/mock/mock_conn_registry.cpp
@@ -60,7 +60,7 @@ ConnectionString::ConnectionHook* MockConnRegistry::getConnStrHook() {
}
void MockConnRegistry::addServer(MockRemoteDBServer* server) {
- stdx::lock_guard<stdx::mutex> sl(_registryMutex);
+ stdx::lock_guard<Latch> sl(_registryMutex);
const std::string hostName(server->getServerAddress());
fassert(16533, _registry.count(hostName) == 0);
@@ -69,17 +69,17 @@ void MockConnRegistry::addServer(MockRemoteDBServer* server) {
}
bool MockConnRegistry::removeServer(const std::string& hostName) {
- stdx::lock_guard<stdx::mutex> sl(_registryMutex);
+ stdx::lock_guard<Latch> sl(_registryMutex);
return _registry.erase(hostName) == 1;
}
void MockConnRegistry::clear() {
- stdx::lock_guard<stdx::mutex> sl(_registryMutex);
+ stdx::lock_guard<Latch> sl(_registryMutex);
_registry.clear();
}
std::unique_ptr<MockDBClientConnection> MockConnRegistry::connect(const std::string& connStr) {
- stdx::lock_guard<stdx::mutex> sl(_registryMutex);
+ stdx::lock_guard<Latch> sl(_registryMutex);
fassert(16534, _registry.count(connStr) == 1);
return std::make_unique<MockDBClientConnection>(_registry[connStr], true);
}
diff --git a/src/mongo/dbtests/mock/mock_conn_registry.h b/src/mongo/dbtests/mock/mock_conn_registry.h
index 5796a0b7f73..feb8eb86517 100644
--- a/src/mongo/dbtests/mock/mock_conn_registry.h
+++ b/src/mongo/dbtests/mock/mock_conn_registry.h
@@ -114,7 +114,7 @@ private:
MockConnHook _mockConnStrHook;
// protects _registry
- stdx::mutex _registryMutex;
+ Mutex _registryMutex = MONGO_MAKE_LATCH("MockConnRegistry::_registryMutex");
stdx::unordered_map<std::string, MockRemoteDBServer*> _registry;
};
} // namespace mongo
diff --git a/src/mongo/dbtests/threadedtests.cpp b/src/mongo/dbtests/threadedtests.cpp
index 92d741bbb92..95ff64d1e8b 100644
--- a/src/mongo/dbtests/threadedtests.cpp
+++ b/src/mongo/dbtests/threadedtests.cpp
@@ -239,7 +239,7 @@ private:
Hotel(int nRooms) : _nRooms(nRooms), _checkedIn(0), _maxRooms(0) {}
void checkIn() {
- stdx::lock_guard<stdx::mutex> lk(_frontDesk);
+ stdx::lock_guard<Latch> lk(_frontDesk);
_checkedIn++;
verify(_checkedIn <= _nRooms);
if (_checkedIn > _maxRooms)
@@ -247,12 +247,12 @@ private:
}
void checkOut() {
- stdx::lock_guard<stdx::mutex> lk(_frontDesk);
+ stdx::lock_guard<Latch> lk(_frontDesk);
_checkedIn--;
verify(_checkedIn >= 0);
}
- stdx::mutex _frontDesk;
+ Mutex _frontDesk = MONGO_MAKE_LATCH("Hotel::_frontDesk");
int _nRooms;
int _checkedIn;
int _maxRooms;