I am trying to implement a C++ extension to be integrated with node.js. This extension will internally invoke some blocking calls, so it needs to provide a non-blocking interface to the node.js world.
As specified in https://nodejs.org/api/addons.html, there are two ways to implement non-blocking callbacks:
b) By using the libuv library in order to, if I understood correctly, post an event to the node.js event loop. I have not read libuv documentation in detail, but this seems quite complex to implement.
My preference of course is a), but I have no idea of what are the implications. Is there any problem if the callback is invoked from a different thread, thus cimcurventing the node.js standard approach to non-blocking IO? Or does libuv need to be used to properly handle the threading for my code and its blocking calls?
Thank you very much for your help.