diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/scripting/mozjs/implscope.cpp | 3 | ||||
-rw-r--r-- | src/mongo/scripting/mozjs/implscope.h | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp index 34729b87a33..f06a20bfc0a 100644 --- a/src/mongo/scripting/mozjs/implscope.cpp +++ b/src/mongo/scripting/mozjs/implscope.cpp @@ -136,6 +136,7 @@ void MozJSImplScope::registerOperation(OperationContext* opCtx) { _opCtx = opCtx; _opId = opCtx->getOpID(); + _opCtxThreadId = stdx::this_thread::get_id(); _engine->registerOperation(opCtx, this); } @@ -153,7 +154,7 @@ void MozJSImplScope::kill() { // If we are on the right thread, in the middle of an operation, and we have a registered // opCtx, then we should check the opCtx for interrupts. - if (_mr._thread.get_id() == stdx::this_thread::get_id() && _inOp > 0 && _opCtx) { + if (_opCtxThreadId == stdx::this_thread::get_id() && _inOp > 0 && _opCtx) { _killStatus = _opCtx->checkForInterruptNoAssert(); } diff --git a/src/mongo/scripting/mozjs/implscope.h b/src/mongo/scripting/mozjs/implscope.h index c774efd3bd3..b842ae3cbef 100644 --- a/src/mongo/scripting/mozjs/implscope.h +++ b/src/mongo/scripting/mozjs/implscope.h @@ -379,7 +379,6 @@ private: public: MozRuntime(const MozJSScriptEngine* engine, boost::optional<int> jsHeapLimitMB); - std::thread _thread; // NOLINT std::unique_ptr<JSRuntime, std::function<void(JSRuntime*)>> _runtime; std::unique_ptr<JSContext, std::function<void(JSContext*)>> _context; }; @@ -417,8 +416,9 @@ private: mutable Mutex _mutex = MONGO_MAKE_LATCH("MozJSImplScope::_mutex"); stdx::condition_variable _sleepCondition; std::string _error; - unsigned int _opId; // op id for this scope - OperationContext* _opCtx; // Op context for DbEval + unsigned int _opId; // op id for this scope + OperationContext* _opCtx; // Op context for DbEval + stdx::thread::id _opCtxThreadId; // Id of the thread that owns '_opCtx' std::size_t _inOp; std::atomic<bool> _pendingGC; // NOLINT ConnectState _connectState; |