summaryrefslogtreecommitdiff
path: root/src/mongo/util/fail_point_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/util/fail_point_test.cpp')
-rw-r--r--src/mongo/util/fail_point_test.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mongo/util/fail_point_test.cpp b/src/mongo/util/fail_point_test.cpp
index 1880b0d18a1..a99d7132a40 100644
--- a/src/mongo/util/fail_point_test.cpp
+++ b/src/mongo/util/fail_point_test.cpp
@@ -36,6 +36,7 @@
#include <string>
#include <vector>
+#include "mongo/platform/mutex.h"
#include "mongo/stdx/thread.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/fail_point.h"
@@ -46,6 +47,7 @@
using mongo::BSONObj;
using mongo::FailPoint;
using mongo::FailPointEnableBlock;
+
namespace stdx = mongo::stdx;
namespace mongo_test {
@@ -157,7 +159,7 @@ public:
void stopTest() {
{
- stdx::lock_guard<stdx::mutex> lk(_mutex);
+ stdx::lock_guard<mongo::Latch> lk(_mutex);
_inShutdown = true;
}
for (auto& t : _tasks) {
@@ -179,7 +181,7 @@ private:
}
});
- stdx::lock_guard<stdx::mutex> lk(_mutex);
+ stdx::lock_guard<mongo::Latch> lk(_mutex);
if (_inShutdown)
break;
}
@@ -200,7 +202,7 @@ private:
} catch (const std::logic_error&) {
}
- stdx::lock_guard<stdx::mutex> lk(_mutex);
+ stdx::lock_guard<mongo::Latch> lk(_mutex);
if (_inShutdown)
break;
}
@@ -209,7 +211,7 @@ private:
void simpleTask() {
while (true) {
static_cast<void>(MONGO_unlikely(_fp.shouldFail()));
- stdx::lock_guard<stdx::mutex> lk(_mutex);
+ stdx::lock_guard<mongo::Latch> lk(_mutex);
if (_inShutdown)
break;
}
@@ -223,7 +225,7 @@ private:
_fp.setMode(FailPoint::alwaysOn, 0, BSON("a" << 44));
}
- stdx::lock_guard<stdx::mutex> lk(_mutex);
+ stdx::lock_guard<mongo::Latch> lk(_mutex);
if (_inShutdown)
break;
}
@@ -231,7 +233,8 @@ private:
FailPoint _fp;
std::vector<stdx::thread> _tasks;
- stdx::mutex _mutex;
+
+ mongo::Mutex _mutex = MONGO_MAKE_LATCH();
bool _inShutdown = false;
};