MCPcopy Index your code
hub / github.com/nodejs/node-addon-api / DoCancel

Method DoCancel

test/async_worker.cc:244–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242 }
243
244 static void DoCancel(const CallbackInfo& info) {
245 Function cb = info[0].As<Function>();
246
247 FailCancelWorker* cancelWorker = new FailCancelWorker(cb);
248 cancelWorker->Queue();
249 cancelWorker->WaitForWorkerTaskToStart();
250
251#ifdef NAPI_CPP_EXCEPTIONS
252 try {
253 cancelWorker->Cancel();
254 } catch (Napi::Error&) {
255 Napi::Error::New(info.Env(), "Unable to cancel async worker tasks")
256 .ThrowAsJavaScriptException();
257 }
258#else
259 cancelWorker->Cancel();
260#endif
261 }
262
263 void Execute() override {
264 NotifyJSThreadTaskHasStarted();

Callers

nothing calls this directly

Calls 5

QueueMethod · 0.80
CancelMethod · 0.80
EnvMethod · 0.80

Tested by

no test coverage detected