Skip to content

Commit f2b7ba3

Browse files
committed
added KickNextTick
more details here: nodejs/nan#284
1 parent 855fc1f commit f2b7ba3

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/native/Common.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#include <sstream>
22
#include "Common.hpp"
33

4+
void KickNextTick(){
5+
Nan::HandleScope scope;
6+
Nan::Callback(Nan::New<v8::Function>([](const Nan::FunctionCallbackInfo<v8::Value>& info){}, Nan::Null())).Call(0, nullptr);
7+
}
8+
49
std::string ArrayBufferToString(v8::Local<v8::ArrayBuffer> arrayBuffer) {
510
v8::ArrayBuffer::Contents contents = arrayBuffer->GetContents();
611
int size = contents.ByteLength();
@@ -42,6 +47,7 @@ v8::Local<v8::Object> GetObjectForPath(const v8::Local<v8::Object>& root, const
4247
return scope.Escape(currentValue);
4348
}
4449

50+
//TODO: verify
4551
void BufferFreeCallback(char* data, void* hint) {
4652
if (hint) {
4753
delete[] data;

src/native/Common.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <google/protobuf/io/zero_copy_stream_impl.h>
77
#include <nan.h>
88

9+
void KickNextTick();
10+
911
std::string ArrayBufferToString(v8::Local<v8::ArrayBuffer> arrayBuffer);
1012

1113
v8::Local<v8::Value> CallFunction(const v8::Local<v8::Object>& object, const std::string& functionName, int argc,

src/native/NodeAsyncWorker.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ class NodeAsyncWorker {
7575
HandleOKCallback();
7676
else
7777
HandleErrorCallback();
78+
79+
KickNextTick();
7880
}
7981

8082
void SetErrorMessage(const char *msg) {

0 commit comments

Comments
 (0)