diff options
author | Jason Carey <jcarey@argv.me> | 2019-01-03 16:38:26 -0500 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2019-02-10 12:23:19 -0500 |
commit | 21b5477520744ca02e1574160caa31e0633849dd (patch) | |
tree | 36f351a91a195a633c9cc495f6249057497249ff /src/mongo/scripting/mozjs/proxyscope.h | |
parent | c922cb18516981ceca59993331296d102f4e01fb (diff) | |
download | mongo-21b5477520744ca02e1574160caa31e0633849dd.tar.gz |
SERVER-39183 honor socket disconnect in $where
Diffstat (limited to 'src/mongo/scripting/mozjs/proxyscope.h')
-rw-r--r-- | src/mongo/scripting/mozjs/proxyscope.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mongo/scripting/mozjs/proxyscope.h b/src/mongo/scripting/mozjs/proxyscope.h index 42d034673a6..3afd17c6dda 100644 --- a/src/mongo/scripting/mozjs/proxyscope.h +++ b/src/mongo/scripting/mozjs/proxyscope.h @@ -35,9 +35,9 @@ #include "mongo/client/dbclient_cursor.h" #include "mongo/scripting/mozjs/engine.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" +#include "mongo/util/functional.h" namespace mongo { namespace mozjs { @@ -51,7 +51,7 @@ class MozJSImplScope; * implementation scope from multiple threads. * * In terms of implementation, it does most of it's heavy lifting through a - * stdx::function. The proxy scope owns an implementation scope transitively + * unique_function. The proxy scope owns an implementation scope transitively * through the thread it owns. They communicate by setting a variable, then * signaling each other. That communication has to work, there's no fallback * for timing out. @@ -174,15 +174,16 @@ public: ScriptingFunction _createFunction(const char* code) override; - OperationContext* getOpContext() const; - void interrupt(); private: template <typename Closure> void run(Closure&& closure); - void runOnImplThread(stdx::function<void()> f); + template <typename Closure> + void runWithoutInterruption(Closure&& closure); + + void runOnImplThread(unique_function<void()> f); void shutdownThread(); static void implThread(void* proxy); @@ -195,9 +196,10 @@ private: * function invocation and exception handling */ stdx::mutex _mutex; - stdx::function<void()> _function; + unique_function<void()> _function; State _state; Status _status; + OperationContext* _opCtx = nullptr; stdx::condition_variable _condvar; PRThread* _thread; |