diff options
Diffstat (limited to 'src/mongo/client/remote_command_retry_scheduler.cpp')
-rw-r--r-- | src/mongo/client/remote_command_retry_scheduler.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mongo/client/remote_command_retry_scheduler.cpp b/src/mongo/client/remote_command_retry_scheduler.cpp index b8eaf0d951f..936c326367d 100644 --- a/src/mongo/client/remote_command_retry_scheduler.cpp +++ b/src/mongo/client/remote_command_retry_scheduler.cpp @@ -78,7 +78,7 @@ RemoteCommandRetryScheduler::~RemoteCommandRetryScheduler() { } bool RemoteCommandRetryScheduler::isActive() const { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); return _isActive_inlock(); } @@ -87,7 +87,7 @@ bool RemoteCommandRetryScheduler::_isActive_inlock() const { } Status RemoteCommandRetryScheduler::startup() { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); switch (_state) { case State::kPreStart: @@ -113,7 +113,7 @@ Status RemoteCommandRetryScheduler::startup() { void RemoteCommandRetryScheduler::shutdown() { executor::TaskExecutor::CallbackHandle remoteCommandCallbackHandle; { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); switch (_state) { case State::kPreStart: // Transition directly from PreStart to Complete if not started yet. @@ -136,12 +136,12 @@ void RemoteCommandRetryScheduler::shutdown() { } void RemoteCommandRetryScheduler::join() { - stdx::unique_lock<stdx::mutex> lock(_mutex); + stdx::unique_lock<Latch> lock(_mutex); _condition.wait(lock, [this]() { return !_isActive_inlock(); }); } std::string RemoteCommandRetryScheduler::toString() const { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); str::stream output; output << "RemoteCommandRetryScheduler"; output << " request: " << _request.toString(); @@ -174,7 +174,7 @@ void RemoteCommandRetryScheduler::_remoteCommandCallback( // Use a lambda to avoid unnecessary lock acquisition when checking conditions for termination. auto getCurrentAttempt = [this]() { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); return _currentAttempt; }; @@ -188,7 +188,7 @@ void RemoteCommandRetryScheduler::_remoteCommandCallback( // TODO(benety): Check cumulative elapsed time of failed responses received against retry // policy. Requires SERVER-24067. auto scheduleStatus = [this]() { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); if (State::kShuttingDown == _state) { return Status(ErrorCodes::CallbackCanceled, "scheduler was shut down before retrying command"); @@ -213,7 +213,7 @@ void RemoteCommandRetryScheduler::_onComplete( // RemoteCommandRetryScheduler, we release this function object outside the lock. _callback = {}; - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); invariant(_isActive_inlock()); _state = State::kComplete; _condition.notify_all(); |