diff options
author | Mathias Stearn <mathias@10gen.com> | 2017-01-13 16:16:21 -0500 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2017-03-24 16:13:26 -0400 |
commit | 63d1f4c049587e7923a1154fc31f29bc190316df (patch) | |
tree | 35f2b6172f26a003d896d8241ca9800d8a3a71d8 /src/mongo/util/background_thread_clock_source.cpp | |
parent | 27ddad2221974798284ef62d3328a3c02a510220 (diff) | |
download | mongo-63d1f4c049587e7923a1154fc31f29bc190316df.tar.gz |
SERVER-27727 Hide idle threads in hang analyzer (extras)
Diffstat (limited to 'src/mongo/util/background_thread_clock_source.cpp')
-rw-r--r-- | src/mongo/util/background_thread_clock_source.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/util/background_thread_clock_source.cpp b/src/mongo/util/background_thread_clock_source.cpp index b533d52b8ea..4ace0a99ad8 100644 --- a/src/mongo/util/background_thread_clock_source.cpp +++ b/src/mongo/util/background_thread_clock_source.cpp @@ -37,6 +37,7 @@ #include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" +#include "mongo/util/concurrency/idle_thread_block.h" #include "mongo/util/log.h" #include "mongo/util/time_support.h" @@ -104,6 +105,7 @@ void BackgroundThreadClockSource::_startTimerThread() { // Start the background thread that repeatedly sleeps for the specified duration of milliseconds // and wakes up to store the current time. _timer = stdx::thread([&]() { + setThreadName("BackgroundThreadClockSource"); stdx::unique_lock<stdx::mutex> lock(_mutex); _started = true; _condition.notify_one(); @@ -114,10 +116,12 @@ void BackgroundThreadClockSource::_startTimerThread() { } else { // Stop running if nothing has read the time since we last updated the time. _current.store(0); + IdleThreadBlock markIdle; _condition.wait(lock, [this] { return _inShutdown || _current.load() != 0; }); } const auto sleepUntil = Date_t::fromMillisSinceEpoch(_current.load()) + _granularity; + IdleThreadBlock markIdle; _clockSource->waitForConditionUntil( _condition, lock, sleepUntil, [this] { return _inShutdown; }); } |