summaryrefslogtreecommitdiff
path: root/src/mongo/scripting
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/scripting
parent27ddad2221974798284ef62d3328a3c02a510220 (diff)
downloadmongo-63d1f4c049587e7923a1154fc31f29bc190316df.tar.gz
SERVER-27727 Hide idle threads in hang analyzer (extras)
Diffstat (limited to 'src/mongo/scripting')
-rw-r--r--src/mongo/scripting/deadline_monitor.h3
-rw-r--r--src/mongo/scripting/mozjs/proxyscope.cpp10
2 files changed, 10 insertions, 3 deletions
diff --git a/src/mongo/scripting/deadline_monitor.h b/src/mongo/scripting/deadline_monitor.h
index a39b78971c5..3f50abe5348 100644
--- a/src/mongo/scripting/deadline_monitor.h
+++ b/src/mongo/scripting/deadline_monitor.h
@@ -35,6 +35,7 @@
#include "mongo/stdx/condition_variable.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/time_support.h"
@@ -132,6 +133,7 @@ private:
* _Task::kill() is invoked.
*/
void deadlineMonitorThread() {
+ setThreadName("DeadlineMonitor");
stdx::unique_lock<stdx::mutex> lk(_deadlineMutex);
Date_t lastInterruptCycle = Date_t::now();
while (!_inShutdown) {
@@ -149,6 +151,7 @@ private:
// wait for a task to be added or a deadline to expire
if (_nearestDeadlineWallclock > now) {
+ IdleThreadBlock markIdle;
if (_nearestDeadlineWallclock == Date_t::max()) {
if ((interruptInterval.count() > 0) &&
(_nearestDeadlineWallclock - now > interruptInterval)) {
diff --git a/src/mongo/scripting/mozjs/proxyscope.cpp b/src/mongo/scripting/mozjs/proxyscope.cpp
index 2b9db2045c2..58084e88ad1 100644
--- a/src/mongo/scripting/mozjs/proxyscope.cpp
+++ b/src/mongo/scripting/mozjs/proxyscope.cpp
@@ -35,6 +35,7 @@
#include "mongo/db/service_context.h"
#include "mongo/platform/decimal128.h"
#include "mongo/scripting/mozjs/implscope.h"
+#include "mongo/util/concurrency/idle_thread_block.h"
#include "mongo/util/destructor_guard.h"
#include "mongo/util/quick_exit.h"
@@ -340,9 +341,12 @@ void MozJSProxyScope::implThread(void* arg) {
while (true) {
stdx::unique_lock<stdx::mutex> lk(proxy->_mutex);
- proxy->_condvar.wait(lk, [proxy] {
- return proxy->_state == State::ProxyRequest || proxy->_state == State::Shutdown;
- });
+ {
+ IdleThreadBlock markIdle;
+ proxy->_condvar.wait(lk, [proxy] {
+ return proxy->_state == State::ProxyRequest || proxy->_state == State::Shutdown;
+ });
+ }
if (proxy->_state == State::Shutdown)
break;