diff options
Diffstat (limited to 'src/mongo/client/fetcher.cpp')
-rw-r--r-- | src/mongo/client/fetcher.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mongo/client/fetcher.cpp b/src/mongo/client/fetcher.cpp index 8843227ded5..df0bfb41077 100644 --- a/src/mongo/client/fetcher.cpp +++ b/src/mongo/client/fetcher.cpp @@ -195,7 +195,7 @@ std::string Fetcher::toString() const { } std::string Fetcher::getDiagnosticString() const { - stdx::lock_guard<stdx::mutex> lk(_mutex); + stdx::lock_guard<Latch> lk(_mutex); str::stream output; output << "Fetcher"; output << " source: " << _source.toString(); @@ -218,7 +218,7 @@ std::string Fetcher::getDiagnosticString() const { } bool Fetcher::isActive() const { - stdx::lock_guard<stdx::mutex> lk(_mutex); + stdx::lock_guard<Latch> lk(_mutex); return _isActive_inlock(); } @@ -227,7 +227,7 @@ bool Fetcher::_isActive_inlock() const { } Status Fetcher::schedule() { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); switch (_state) { case State::kPreStart: _state = State::kRunning; @@ -250,7 +250,7 @@ Status Fetcher::schedule() { } void Fetcher::shutdown() { - 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. @@ -273,17 +273,17 @@ void Fetcher::shutdown() { } void Fetcher::join() { - stdx::unique_lock<stdx::mutex> lk(_mutex); + stdx::unique_lock<Latch> lk(_mutex); _condition.wait(lk, [this]() { return !_isActive_inlock(); }); } Fetcher::State Fetcher::getState_forTest() const { - stdx::lock_guard<stdx::mutex> lk(_mutex); + stdx::lock_guard<Latch> lk(_mutex); return _state; } bool Fetcher::_isShuttingDown() const { - stdx::lock_guard<stdx::mutex> lk(_mutex); + stdx::lock_guard<Latch> lk(_mutex); return _isShuttingDown_inlock(); } @@ -292,7 +292,7 @@ bool Fetcher::_isShuttingDown_inlock() const { } Status Fetcher::_scheduleGetMore(const BSONObj& cmdObj) { - stdx::lock_guard<stdx::mutex> lk(_mutex); + stdx::lock_guard<Latch> lk(_mutex); if (_isShuttingDown_inlock()) { return Status(ErrorCodes::CallbackCanceled, "fetcher was shut down after previous batch was processed"); @@ -347,7 +347,7 @@ void Fetcher::_callback(const RemoteCommandCallbackArgs& rcbd, const char* batch batchData.otherFields.metadata = std::move(rcbd.response.data); batchData.elapsedMillis = rcbd.response.elapsedMillis.value_or(Milliseconds{0}); { - stdx::lock_guard<stdx::mutex> lk(_mutex); + stdx::lock_guard<Latch> lk(_mutex); batchData.first = _first; _first = false; } @@ -416,7 +416,7 @@ void Fetcher::_finishCallback() { // 'tempWork' must be declared before lock guard 'lk' so that it is destroyed outside the lock. Fetcher::CallbackFn tempWork; - stdx::lock_guard<stdx::mutex> lk(_mutex); + stdx::lock_guard<Latch> lk(_mutex); invariant(State::kComplete != _state); _state = State::kComplete; _first = false; |