summaryrefslogtreecommitdiff
path: root/src/mongo/util/background.cpp
diff options
context:
space:
mode:
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();
}
}