MCPcopy Create free account
hub / github.com/NodeRT/NodeRT / AsyncAfter

Method AsyncAfter

src/NodeRTLib/ProjectFiles/node-async.h:315–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313
314 template <typename TInput, typename TResult>
315 static void __cdecl AsyncAfter(uv_work_t* req, int status) {
316 HandleScope scope;
317 ;
318 Baton<TInput, TResult>* baton =
319 static_cast<Baton<TInput, TResult>*>(req->data);
320
321 // typical AfterWorkFunc implementation
322 // if (baton->error)
323 //{
324 // Handle<Value> err = Exception::Error(...);
325 // Handle<Value> argv[] = { err };
326 // baton->setCallbackArgs(argv, _countof(argv));
327 //}
328 // else
329 //{
330 // Handle<Value> argv[] = { Undefined(), ... };
331 // baton->setCallbackArgs(argv, _countof(argv));
332 //}
333
334 baton->afterWork(baton);
335
336 if (!baton->callbackData.IsEmpty()) {
337 // call the callback, using domains and all
338 int argc = static_cast<int>(baton->callback_args_size);
339 std::unique_ptr<Local<Value>> handlesArr(new Local<Value>[argc]);
340 for (int i = 0; i < argc; i++) {
341 handlesArr.get()[i] = New(baton->callback_info.get()[i]);
342 }
343
344 MakeCallback(New(baton->callbackData),
345 New<String>("callback").ToLocalChecked(), argc,
346 handlesArr.get());
347 }
348
349 baton->callbackData.Reset();
350 delete baton;
351 }
352
353 // called after the async handle is closed in order to free it's memory
354 static void __cdecl AyncCloseCb(uv_handle_t* handle) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected