2

Is it possible to create napi_value from a node.js (native) worker thread and share the value with the main thread.

For example:

napi_create_async_work( env, NULL, resource_name, Execute,  OnComplete,
                                       DataEx, &DataEx->work);
napi_queue_async_work(env, DataEx->work);

then construct a napi_value from the "Execute()" function (which will be getting executed by a worker pool thread).
eg:

void Execute(napi_env env, void *data)
{
  --   --   --
  napi_value val;    
  napi_create_int32( env, 101, &val);
  --   --  --
}
Satyan
  • 1,346
  • 8
  • 15

0 Answers0