diff options
author | Ben Caimano <ben.caimano@mongodb.com> | 2019-09-17 23:22:19 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-09-17 23:22:19 +0000 |
commit | bc11369435ca51e2ff6897433d00f6b909f6a25f (patch) | |
tree | 251653ec8285d798b41846e343e7e414e80ff277 /src/mongo/db/repl/oplog_test.cpp | |
parent | 45aea2495306dd61fab46bd398735bb6aaf7b53a (diff) | |
download | mongo-bc11369435ca51e2ff6897433d00f6b909f6a25f.tar.gz |
SERVER-42165 Replace uses of stdx::mutex with mongo::Mutex
Diffstat (limited to 'src/mongo/db/repl/oplog_test.cpp')
-rw-r--r-- | src/mongo/db/repl/oplog_test.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/mongo/db/repl/oplog_test.cpp b/src/mongo/db/repl/oplog_test.cpp index a39208720ce..d6e23d6c3ac 100644 --- a/src/mongo/db/repl/oplog_test.cpp +++ b/src/mongo/db/repl/oplog_test.cpp @@ -45,7 +45,7 @@ #include "mongo/db/repl/repl_client_info.h" #include "mongo/db/repl/replication_coordinator_mock.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/mutex.h" +#include "mongo/platform/mutex.h" #include "mongo/unittest/barrier.h" #include "mongo/util/concurrency/thread_pool.h" @@ -165,7 +165,7 @@ void _testConcurrentLogOp(const F& makeTaskFunction, // Run 2 concurrent logOp() requests using the thread pool. // Use a barrier with a thread count of 3 to ensure both logOp() tasks are complete before this // test thread can proceed with shutting the thread pool down. - stdx::mutex mtx; + auto mtx = MONGO_MAKE_LATCH(); unittest::Barrier barrier(3U); const NamespaceString nss1("test1.coll"); const NamespaceString nss2("test2.coll"); @@ -200,7 +200,7 @@ void _testConcurrentLogOp(const F& makeTaskFunction, std::reverse(oplogEntries->begin(), oplogEntries->end()); // Look up namespaces and their respective optimes (returned by logOp()) in the map. - stdx::lock_guard<stdx::mutex> lock(mtx); + stdx::lock_guard<Latch> lock(mtx); ASSERT_EQUALS(2U, opTimeNssMap->size()); } @@ -210,10 +210,10 @@ void _testConcurrentLogOp(const F& makeTaskFunction, * Returns optime of generated oplog entry. */ OpTime _logOpNoopWithMsg(OperationContext* opCtx, - stdx::mutex* mtx, + Mutex* mtx, OpTimeNamespaceStringMap* opTimeNssMap, const NamespaceString& nss) { - stdx::lock_guard<stdx::mutex> lock(*mtx); + stdx::lock_guard<Latch> lock(*mtx); // logOp() must be called while holding lock because ephemeralForTest storage engine does not // support concurrent updates to its internal state. @@ -239,7 +239,7 @@ TEST_F(OplogTest, ConcurrentLogOpWithoutDocLockingSupport) { _testConcurrentLogOp( [](const NamespaceString& nss, - stdx::mutex* mtx, + Mutex* mtx, OpTimeNamespaceStringMap* opTimeNssMap, unittest::Barrier* barrier) { return [=] { @@ -272,7 +272,7 @@ TEST_F(OplogTest, ConcurrentLogOpWithDocLockingSupport) { ForceSupportsDocLocking support(true); _testConcurrentLogOp( [](const NamespaceString& nss, - stdx::mutex* mtx, + Mutex* mtx, OpTimeNamespaceStringMap* opTimeNssMap, unittest::Barrier* barrier) { return [=] { @@ -304,7 +304,7 @@ TEST_F(OplogTest, ConcurrentLogOpWithDocLockingSupportRevertFirstOplogEntry) { ForceSupportsDocLocking support(true); _testConcurrentLogOp( [](const NamespaceString& nss, - stdx::mutex* mtx, + Mutex* mtx, OpTimeNamespaceStringMap* opTimeNssMap, unittest::Barrier* barrier) { return [=] { @@ -322,7 +322,7 @@ TEST_F(OplogTest, ConcurrentLogOpWithDocLockingSupportRevertFirstOplogEntry) { // Revert the first logOp() call and confirm that there are no holes in the // oplog after committing the oplog entry with the more recent optime. { - stdx::lock_guard<stdx::mutex> lock(*mtx); + stdx::lock_guard<Latch> lock(*mtx); auto firstOpTimeAndNss = *(opTimeNssMap->cbegin()); if (opTime == firstOpTimeAndNss.first) { ASSERT_EQUALS(nss, firstOpTimeAndNss.second) @@ -351,7 +351,7 @@ TEST_F(OplogTest, ConcurrentLogOpWithDocLockingSupportRevertLastOplogEntry) { ForceSupportsDocLocking support(true); _testConcurrentLogOp( [](const NamespaceString& nss, - stdx::mutex* mtx, + Mutex* mtx, OpTimeNamespaceStringMap* opTimeNssMap, unittest::Barrier* barrier) { return [=] { @@ -369,7 +369,7 @@ TEST_F(OplogTest, ConcurrentLogOpWithDocLockingSupportRevertLastOplogEntry) { // Revert the last logOp() call and confirm that there are no holes in the // oplog after committing the oplog entry with the earlier optime. { - stdx::lock_guard<stdx::mutex> lock(*mtx); + stdx::lock_guard<Latch> lock(*mtx); auto lastOpTimeAndNss = *(opTimeNssMap->crbegin()); if (opTime == lastOpTimeAndNss.first) { ASSERT_EQUALS(nss, lastOpTimeAndNss.second) |