diff options
author | clang-format-7.0.1 <adam.martin@10gen.com> | 2019-07-26 18:42:24 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-07-26 18:42:24 -0400 |
commit | c1a45ebbb0530e3d0201321d725527f1eb83ffce (patch) | |
tree | f523079dc5ded3052eefbdcaae424b7502df5b25 /src/mongo/transport/service_executor_adaptive.cpp | |
parent | c9599d8610c3da0b7c3da65667aff821063cf5b9 (diff) | |
download | mongo-c1a45ebbb0530e3d0201321d725527f1eb83ffce.tar.gz |
Apply formatting per `clang-format-7.0.1`
Diffstat (limited to 'src/mongo/transport/service_executor_adaptive.cpp')
-rw-r--r-- | src/mongo/transport/service_executor_adaptive.cpp | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/src/mongo/transport/service_executor_adaptive.cpp b/src/mongo/transport/service_executor_adaptive.cpp index 9b9d3e9c734..b8a39e9fcb7 100644 --- a/src/mongo/transport/service_executor_adaptive.cpp +++ b/src/mongo/transport/service_executor_adaptive.cpp @@ -183,34 +183,35 @@ Status ServiceExecutorAdaptive::schedule(ServiceExecutorAdaptive::Task task, } auto wrappedTask = - [ this, task = std::move(task), scheduleTime, pendingCounterPtr, taskName, flags ]( + [this, task = std::move(task), scheduleTime, pendingCounterPtr, taskName, flags]( auto status) { - pendingCounterPtr->subtractAndFetch(1); - auto start = _tickSource->getTicks(); - _totalSpentQueued.addAndFetch(start - scheduleTime); + pendingCounterPtr->subtractAndFetch(1); + auto start = _tickSource->getTicks(); + _totalSpentQueued.addAndFetch(start - scheduleTime); - _localThreadState->threadMetrics[static_cast<size_t>(taskName)] - ._totalSpentQueued.addAndFetch(start - scheduleTime); + _localThreadState->threadMetrics[static_cast<size_t>(taskName)] + ._totalSpentQueued.addAndFetch(start - scheduleTime); - if (_localThreadState->recursionDepth++ == 0) { - _localThreadState->executing.markRunning(); - _threadsInUse.addAndFetch(1); - } - const auto guard = makeGuard([this, taskName] { - if (--_localThreadState->recursionDepth == 0) { - _localThreadState->executingCurRun += _localThreadState->executing.markStopped(); - _threadsInUse.subtractAndFetch(1); + if (_localThreadState->recursionDepth++ == 0) { + _localThreadState->executing.markRunning(); + _threadsInUse.addAndFetch(1); } - _totalExecuted.addAndFetch(1); + const auto guard = makeGuard([this, taskName] { + if (--_localThreadState->recursionDepth == 0) { + _localThreadState->executingCurRun += + _localThreadState->executing.markStopped(); + _threadsInUse.subtractAndFetch(1); + } + _totalExecuted.addAndFetch(1); + _localThreadState->threadMetrics[static_cast<size_t>(taskName)] + ._totalExecuted.addAndFetch(1); + }); + + TickTimer _localTimer(_tickSource); + task(); _localThreadState->threadMetrics[static_cast<size_t>(taskName)] - ._totalExecuted.addAndFetch(1); - }); - - TickTimer _localTimer(_tickSource); - task(); - _localThreadState->threadMetrics[static_cast<size_t>(taskName)] - ._totalSpentExecuting.addAndFetch(_localTimer.sinceStartTicks()); - }; + ._totalSpentExecuting.addAndFetch(_localTimer.sinceStartTicks()); + }; // Dispatching a task on the io_context will run the task immediately, and may run it // on the current thread (if the current thread is running the io_context right now). |