Skip to content

Commit 3206927

Browse files
committed
Add node::CallbackScope to loop callbacks
1 parent 77b81d9 commit 3206927

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

generate/templates/manual/src/thread_pool.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <nan.h>
12
#include "../include/thread_pool.h"
23

34
ThreadPool::ThreadPool(int numberOfThreads, uv_loop_t *loop) {
@@ -73,6 +74,9 @@ void ThreadPool::RunLoopCallbacks(uv_async_t* handle) {
7374
}
7475

7576
void ThreadPool::RunLoopCallbacks() {
77+
Nan::HandleScope scope;
78+
v8::Local<v8::Context> context = Nan::GetCurrentContext();
79+
node::CallbackScope callbackScope(context->GetIsolate(), Nan::New<v8::Object>(), {0, 0});
7680
// get the next callback to run
7781
uv_mutex_lock(&loopMutex);
7882
LoopCallback loopCallback = loopQueue.front();

0 commit comments

Comments
 (0)