R
R
Roman Sopov2015-09-09 16:10:57
Node.js
Roman Sopov, 2015-09-09 16:10:57

How to make asynchronous callback in node.js addon?

I did not find a solution on the Internet. It is necessary to make an asynchronous callback, the function must be executed in a separate thread, and upon completion, call the callback.
Such code works only in one thread, and when you try to call it from another thread, the application crashes.

Local<Function> callback = Local<Function>::Cast(args[1]);
callback->Call(isolate->GetCurrentContext()->Global(), 1, argv);

Tell me how to implement it? Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2015-09-12
@ACCNCC

Use Promise

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question