summaryrefslogtreecommitdiff
path: root/src/mongo/transport
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2019-01-09 17:32:12 -0500
committerBilly Donahue <billy.donahue@mongodb.com>2019-01-11 10:50:23 -0500
commitbbf28648de0d8695c502e13922a8d9e5ca1b51e8 (patch)
tree6382810d03fb698d9b2d49f488be90e604324811 /src/mongo/transport
parent17514947cc816df2500aa0e919506586d4d56aa0 (diff)
downloadmongo-bbf28648de0d8695c502e13922a8d9e5ca1b51e8.tar.gz
SERVER-30711: scope_guard rewrite, to avoid -Werror=noexcept-type
Macro ON_BLOCK_EXIT(...) now takes a single callable, Some renames: Dismias -> dismiss MakeGuard => makeGuard
Diffstat (limited to 'src/mongo/transport')
-rw-r--r--src/mongo/transport/baton_asio_linux.h4
-rw-r--r--src/mongo/transport/service_executor_adaptive.cpp4
-rw-r--r--src/mongo/transport/service_executor_adaptive_test.cpp10
-rw-r--r--src/mongo/transport/service_executor_reserved.cpp2
-rw-r--r--src/mongo/transport/service_executor_test.cpp4
-rw-r--r--src/mongo/transport/transport_layer_asio_integration_test.cpp6
6 files changed, 15 insertions, 15 deletions
diff --git a/src/mongo/transport/baton_asio_linux.h b/src/mongo/transport/baton_asio_linux.h
index e8dcf79deeb..63bfe67da3f 100644
--- a/src/mongo/transport/baton_asio_linux.h
+++ b/src/mongo/transport/baton_asio_linux.h
@@ -248,7 +248,7 @@ public:
std::vector<Promise<void>> toFulfill;
// We'll fulfill promises and run jobs on the way out, ensuring we don't hold any locks
- const auto guard = MakeGuard([&] {
+ const auto guard = makeGuard([&] {
for (auto& promise : toFulfill) {
promise.emplaceValue();
}
@@ -315,7 +315,7 @@ public:
pollSet.size(),
deadline ? Milliseconds(*deadline - now).count() : -1);
- const auto pollGuard = MakeGuard([&] {
+ const auto pollGuard = makeGuard([&] {
lk.lock();
_inPoll = false;
});
diff --git a/src/mongo/transport/service_executor_adaptive.cpp b/src/mongo/transport/service_executor_adaptive.cpp
index d7370bce318..649382086b1 100644
--- a/src/mongo/transport/service_executor_adaptive.cpp
+++ b/src/mongo/transport/service_executor_adaptive.cpp
@@ -224,7 +224,7 @@ Status ServiceExecutorAdaptive::schedule(ServiceExecutorAdaptive::Task task,
_localThreadState->executing.markRunning();
_threadsInUse.addAndFetch(1);
}
- const auto guard = MakeGuard([this, taskName] {
+ const auto guard = makeGuard([this, taskName] {
if (--_localThreadState->recursionDepth == 0) {
_localThreadState->executingCurRun += _localThreadState->executing.markStopped();
_threadsInUse.subtractAndFetch(1);
@@ -563,7 +563,7 @@ void ServiceExecutorAdaptive::_workerThreadRoutine(
log() << "Started new database worker thread " << threadId;
bool guardThreadsRunning = true;
- const auto guard = MakeGuard([this, &guardThreadsRunning, state] {
+ const auto guard = makeGuard([this, &guardThreadsRunning, state] {
if (guardThreadsRunning)
_threadsRunning.subtractAndFetch(1);
_pastThreadsSpentRunning.addAndFetch(state->running.totalTime());
diff --git a/src/mongo/transport/service_executor_adaptive_test.cpp b/src/mongo/transport/service_executor_adaptive_test.cpp
index 66d00b1dfd9..04dff386f4b 100644
--- a/src/mongo/transport/service_executor_adaptive_test.cpp
+++ b/src/mongo/transport/service_executor_adaptive_test.cpp
@@ -168,7 +168,7 @@ TEST_F(ServiceExecutorAdaptiveFixture, TestStuckTask) {
stdx::unique_lock<stdx::mutex> blockedLock(blockedMutex);
auto exec = makeAndStartExecutor<TestOptions>();
- auto guard = MakeGuard([&] {
+ auto guard = makeGuard([&] {
if (blockedLock)
blockedLock.unlock();
ASSERT_OK(exec->shutdown(config->workerThreadRunTime() * 2));
@@ -213,7 +213,7 @@ TEST_F(ServiceExecutorAdaptiveFixture, TestStuckThreads) {
stdx::unique_lock<stdx::mutex> blockedLock(blockedMutex);
auto exec = makeAndStartExecutor<TestOptions>();
- auto guard = MakeGuard([&] {
+ auto guard = makeGuard([&] {
if (blockedLock)
blockedLock.unlock();
ASSERT_OK(exec->shutdown(config->workerThreadRunTime() * 2));
@@ -264,7 +264,7 @@ TEST_F(ServiceExecutorAdaptiveFixture, TestStarvation) {
// Mutex so we don't attempt to call schedule and shutdown concurrently
stdx::mutex scheduleMutex;
- auto guard = MakeGuard([&] { ASSERT_OK(exec->shutdown(config->workerThreadRunTime() * 2)); });
+ auto guard = makeGuard([&] { ASSERT_OK(exec->shutdown(config->workerThreadRunTime() * 2)); });
bool scheduleNew{true};
@@ -316,7 +316,7 @@ TEST_F(ServiceExecutorAdaptiveFixture, TestRecursion) {
stdx::condition_variable cv;
stdx::function<void()> task;
- auto guard = MakeGuard([&] { ASSERT_OK(exec->shutdown(config->workerThreadRunTime() * 2)); });
+ auto guard = makeGuard([&] { ASSERT_OK(exec->shutdown(config->workerThreadRunTime() * 2)); });
task = [this, &task, &exec, &mutex, &cv, &remainingTasks] {
if (remainingTasks.subtractAndFetch(1) == 0) {
@@ -358,7 +358,7 @@ TEST_F(ServiceExecutorAdaptiveFixture, TestDeferredTasks) {
stdx::unique_lock<stdx::mutex> blockedLock(blockedMutex);
auto exec = makeAndStartExecutor<TestOptions>();
- auto guard = MakeGuard([&] {
+ auto guard = makeGuard([&] {
if (blockedLock)
blockedLock.unlock();
ASSERT_OK(exec->shutdown(config->workerThreadRunTime() * 2));
diff --git a/src/mongo/transport/service_executor_reserved.cpp b/src/mongo/transport/service_executor_reserved.cpp
index 93409ba9e26..beeb7618bd0 100644
--- a/src/mongo/transport/service_executor_reserved.cpp
+++ b/src/mongo/transport/service_executor_reserved.cpp
@@ -88,7 +88,7 @@ Status ServiceExecutorReserved::_startWorker() {
return launchServiceWorkerThread([this] {
stdx::unique_lock<stdx::mutex> lk(_mutex);
_numRunningWorkerThreads.addAndFetch(1);
- auto numRunningGuard = MakeGuard([&] {
+ auto numRunningGuard = makeGuard([&] {
_numRunningWorkerThreads.subtractAndFetch(1);
_shutdownCondition.notify_one();
});
diff --git a/src/mongo/transport/service_executor_test.cpp b/src/mongo/transport/service_executor_test.cpp
index f6c66ec98b7..9d2d28d12c1 100644
--- a/src/mongo/transport/service_executor_test.cpp
+++ b/src/mongo/transport/service_executor_test.cpp
@@ -198,7 +198,7 @@ void scheduleBasicTask(ServiceExecutor* exec, bool expectSuccess) {
TEST_F(ServiceExecutorAdaptiveFixture, BasicTaskRuns) {
ASSERT_OK(executor->start());
- auto guard = MakeGuard([this] { ASSERT_OK(executor->shutdown(kShutdownTime)); });
+ auto guard = makeGuard([this] { ASSERT_OK(executor->shutdown(kShutdownTime)); });
scheduleBasicTask(executor.get(), true);
}
@@ -209,7 +209,7 @@ TEST_F(ServiceExecutorAdaptiveFixture, ScheduleFailsBeforeStartup) {
TEST_F(ServiceExecutorSynchronousFixture, BasicTaskRuns) {
ASSERT_OK(executor->start());
- auto guard = MakeGuard([this] { ASSERT_OK(executor->shutdown(kShutdownTime)); });
+ auto guard = makeGuard([this] { ASSERT_OK(executor->shutdown(kShutdownTime)); });
scheduleBasicTask(executor.get(), true);
}
diff --git a/src/mongo/transport/transport_layer_asio_integration_test.cpp b/src/mongo/transport/transport_layer_asio_integration_test.cpp
index 39edbea0be8..00b73b246db 100644
--- a/src/mongo/transport/transport_layer_asio_integration_test.cpp
+++ b/src/mongo/transport/transport_layer_asio_integration_test.cpp
@@ -106,7 +106,7 @@ TEST(TransportLayerASIO, ShortReadsAndWritesWork) {
auto reactor = sc->getTransportLayer()->getReactor(transport::TransportLayer::kNewReactor);
stdx::thread thread([&] { reactor->run(); });
- const auto threadGuard = MakeGuard([&] {
+ const auto threadGuard = makeGuard([&] {
reactor->stop();
thread.join();
});
@@ -129,7 +129,7 @@ TEST(TransportLayerASIO, ShortReadsAndWritesWork) {
if (auto baton = sc->getTransportLayer()->makeBaton(opCtx.get())) {
auto future = handle->runCommandRequest(ecr, baton);
- const auto batonGuard = MakeGuard([&] { baton->detach(); });
+ const auto batonGuard = makeGuard([&] { baton->detach(); });
future.get(opCtx.get());
}
@@ -144,7 +144,7 @@ TEST(TransportLayerASIO, asyncConnectTimeoutCleansUpSocket) {
stdx::thread thread([&] { reactor->run(); });
- const auto threadGuard = MakeGuard([&] {
+ const auto threadGuard = makeGuard([&] {
reactor->stop();
thread.join();
});