diff options
Diffstat (limited to 'src/mongo/db/ftdc/controller.cpp')
-rw-r--r-- | src/mongo/db/ftdc/controller.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/mongo/db/ftdc/controller.cpp b/src/mongo/db/ftdc/controller.cpp index 0bb2e44fa21..7aaf071bfa8 100644 --- a/src/mongo/db/ftdc/controller.cpp +++ b/src/mongo/db/ftdc/controller.cpp @@ -37,9 +37,9 @@ #include "mongo/db/ftdc/collector.h" #include "mongo/db/ftdc/util.h" #include "mongo/db/jsobj.h" +#include "mongo/platform/mutex.h" #include "mongo/stdx/condition_variable.h" #include "mongo/stdx/memory.h" -#include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/idle_thread_block.h" #include "mongo/util/exit.h" @@ -49,7 +49,7 @@ namespace mongo { Status FTDCController::setEnabled(bool enabled) { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); if (_path.empty()) { return Status(ErrorCodes::FTDCPathNotSet, @@ -64,37 +64,37 @@ Status FTDCController::setEnabled(bool enabled) { } void FTDCController::setPeriod(Milliseconds millis) { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); _configTemp.period = millis; _condvar.notify_one(); } void FTDCController::setMaxDirectorySizeBytes(std::uint64_t size) { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); _configTemp.maxDirectorySizeBytes = size; _condvar.notify_one(); } void FTDCController::setMaxFileSizeBytes(std::uint64_t size) { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); _configTemp.maxFileSizeBytes = size; _condvar.notify_one(); } void FTDCController::setMaxSamplesPerArchiveMetricChunk(size_t size) { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); _configTemp.maxSamplesPerArchiveMetricChunk = size; _condvar.notify_one(); } void FTDCController::setMaxSamplesPerInterimMetricChunk(size_t size) { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); _configTemp.maxSamplesPerInterimMetricChunk = size; _condvar.notify_one(); } Status FTDCController::setDirectory(const boost::filesystem::path& path) { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); if (!_path.empty()) { return Status(ErrorCodes::FTDCPathAlreadySet, @@ -112,7 +112,7 @@ Status FTDCController::setDirectory(const boost::filesystem::path& path) { void FTDCController::addPeriodicCollector(std::unique_ptr<FTDCCollectorInterface> collector) { { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); invariant(_state == State::kNotStarted); _periodicCollectors.add(std::move(collector)); @@ -121,7 +121,7 @@ void FTDCController::addPeriodicCollector(std::unique_ptr<FTDCCollectorInterface void FTDCController::addOnRotateCollector(std::unique_ptr<FTDCCollectorInterface> collector) { { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); invariant(_state == State::kNotStarted); _rotateCollectors.add(std::move(collector)); @@ -130,7 +130,7 @@ void FTDCController::addOnRotateCollector(std::unique_ptr<FTDCCollectorInterface BSONObj FTDCController::getMostRecentPeriodicDocument() { { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); return _mostRecentPeriodicDocument.getOwned(); } } @@ -143,7 +143,7 @@ void FTDCController::start() { _thread = stdx::thread([this] { doLoop(); }); { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); invariant(_state == State::kNotStarted); _state = State::kStarted; @@ -154,7 +154,7 @@ void FTDCController::stop() { log() << "Shutting down full-time diagnostic data capture"; { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); bool started = (_state == State::kStarted); @@ -188,7 +188,7 @@ void FTDCController::doLoop() { try { // Update config { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); _config = _configTemp; } @@ -205,7 +205,7 @@ void FTDCController::doLoop() { // Wait for the next run or signal to shutdown { - stdx::unique_lock<stdx::mutex> lock(_mutex); + stdx::unique_lock<Latch> lock(_mutex); MONGO_IDLE_THREAD_BLOCK; // We ignore spurious wakeups by just doing an iteration of the loop @@ -251,7 +251,7 @@ void FTDCController::doLoop() { // Store a reference to the most recent document from the periodic collectors { - stdx::lock_guard<stdx::mutex> lock(_mutex); + stdx::lock_guard<Latch> lock(_mutex); _mostRecentPeriodicDocument = std::get<0>(collectSample); } } |