summaryrefslogtreecommitdiff
path: root/src/mongo/util/background.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-01-13 16:16:21 -0500
committerMathias Stearn <mathias@10gen.com>2017-03-24 16:13:26 -0400
commit63d1f4c049587e7923a1154fc31f29bc190316df (patch)
tree35f2b6172f26a003d896d8241ca9800d8a3a71d8 /src/mongo/util/background.cpp
parent27ddad2221974798284ef62d3328a3c02a510220 (diff)
downloadmongo-63d1f4c049587e7923a1154fc31f29bc190316df.tar.gz
SERVER-27727 Hide idle threads in hang analyzer (extras)
Diffstat (limited to 'src/mongo/util/background.cpp')
-rw-r--r--src/mongo/util/background.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/util/background.cpp b/src/mongo/util/background.cpp
index 6e3d27501c6..4c2085caf67 100644
--- a/src/mongo/util/background.cpp
+++ b/src/mongo/util/background.cpp
@@ -38,6 +38,7 @@
#include "mongo/stdx/functional.h"
#include "mongo/stdx/mutex.h"
#include "mongo/stdx/thread.h"
+#include "mongo/util/concurrency/idle_thread_block.h"
#include "mongo/util/concurrency/mutex.h"
#include "mongo/util/concurrency/spin_lock.h"
#include "mongo/util/concurrency/thread_name.h"
@@ -309,8 +310,12 @@ void PeriodicTaskRunner::run() {
stdx::unique_lock<stdx::mutex> lock(_mutex);
while (!_shutdownRequested) {
- if (stdx::cv_status::timeout == _cond.wait_for(lock, waitTime.toSystemDuration()))
- _runTasks();
+ {
+ IdleThreadBlock markIdle;
+ if (stdx::cv_status::timeout != _cond.wait_for(lock, waitTime.toSystemDuration()))
+ continue;
+ }
+ _runTasks();
}
}