summaryrefslogtreecommitdiff
path: root/src/mongo/executor/network_interface_thread_pool.cpp
diff options
context:
space:
mode:
authorBen Caimano <ben.caimano@mongodb.com>2019-09-17 23:22:19 +0000
committerevergreen <evergreen@mongodb.com>2019-09-17 23:22:19 +0000
commitbc11369435ca51e2ff6897433d00f6b909f6a25f (patch)
tree251653ec8285d798b41846e343e7e414e80ff277 /src/mongo/executor/network_interface_thread_pool.cpp
parent45aea2495306dd61fab46bd398735bb6aaf7b53a (diff)
downloadmongo-bc11369435ca51e2ff6897433d00f6b909f6a25f.tar.gz
SERVER-42165 Replace uses of stdx::mutex with mongo::Mutex
Diffstat (limited to 'src/mongo/executor/network_interface_thread_pool.cpp')
-rw-r--r--src/mongo/executor/network_interface_thread_pool.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mongo/executor/network_interface_thread_pool.cpp b/src/mongo/executor/network_interface_thread_pool.cpp
index 787bd0a6dac..f40a298aea1 100644
--- a/src/mongo/executor/network_interface_thread_pool.cpp
+++ b/src/mongo/executor/network_interface_thread_pool.cpp
@@ -49,7 +49,7 @@ NetworkInterfaceThreadPool::~NetworkInterfaceThreadPool() {
void NetworkInterfaceThreadPool::_dtorImpl() {
{
- stdx::unique_lock<stdx::mutex> lk(_mutex);
+ stdx::unique_lock<Latch> lk(_mutex);
if (_tasks.empty())
return;
@@ -63,7 +63,7 @@ void NetworkInterfaceThreadPool::_dtorImpl() {
}
void NetworkInterfaceThreadPool::startup() {
- stdx::unique_lock<stdx::mutex> lk(_mutex);
+ stdx::unique_lock<Latch> lk(_mutex);
if (_started) {
severe() << "Attempting to start pool, but it has already started";
fassertFailed(34358);
@@ -75,7 +75,7 @@ void NetworkInterfaceThreadPool::startup() {
void NetworkInterfaceThreadPool::shutdown() {
{
- stdx::lock_guard<stdx::mutex> lk(_mutex);
+ stdx::lock_guard<Latch> lk(_mutex);
_inShutdown = true;
}
@@ -84,7 +84,7 @@ void NetworkInterfaceThreadPool::shutdown() {
void NetworkInterfaceThreadPool::join() {
{
- stdx::unique_lock<stdx::mutex> lk(_mutex);
+ stdx::unique_lock<Latch> lk(_mutex);
if (_joining) {
severe() << "Attempted to join pool more than once";
@@ -100,13 +100,13 @@ void NetworkInterfaceThreadPool::join() {
_net->signalWorkAvailable();
- stdx::unique_lock<stdx::mutex> lk(_mutex);
+ stdx::unique_lock<Latch> lk(_mutex);
_joiningCondition.wait(
lk, [&] { return _tasks.empty() && (_consumeState == ConsumeState::kNeutral); });
}
void NetworkInterfaceThreadPool::schedule(Task task) {
- stdx::unique_lock<stdx::mutex> lk(_mutex);
+ stdx::unique_lock<Latch> lk(_mutex);
if (_inShutdown) {
lk.unlock();
task({ErrorCodes::ShutdownInProgress, "Shutdown in progress"});
@@ -127,7 +127,7 @@ void NetworkInterfaceThreadPool::schedule(Task task) {
* allows us to use the network interface's threads as our own pool, which should reduce context
* switches if our tasks are getting scheduled by network interface tasks.
*/
-void NetworkInterfaceThreadPool::_consumeTasks(stdx::unique_lock<stdx::mutex> lk) {
+void NetworkInterfaceThreadPool::_consumeTasks(stdx::unique_lock<Latch> lk) {
if ((_consumeState != ConsumeState::kNeutral) || _tasks.empty())
return;
@@ -140,7 +140,7 @@ void NetworkInterfaceThreadPool::_consumeTasks(stdx::unique_lock<stdx::mutex> lk
_consumeState = ConsumeState::kScheduled;
lk.unlock();
auto ret = _net->schedule([this](Status status) {
- stdx::unique_lock<stdx::mutex> lk(_mutex);
+ stdx::unique_lock<Latch> lk(_mutex);
if (_consumeState != ConsumeState::kScheduled)
return;
@@ -149,7 +149,7 @@ void NetworkInterfaceThreadPool::_consumeTasks(stdx::unique_lock<stdx::mutex> lk
invariant(ret.isOK() || ErrorCodes::isShutdownError(ret.code()));
}
-void NetworkInterfaceThreadPool::_consumeTasksInline(stdx::unique_lock<stdx::mutex> lk) noexcept {
+void NetworkInterfaceThreadPool::_consumeTasksInline(stdx::unique_lock<Latch> lk) noexcept {
_consumeState = ConsumeState::kConsuming;
const auto consumingTasksGuard = makeGuard([&] { _consumeState = ConsumeState::kNeutral; });