Hello, Thank you for the effort to create and maintain the C++ wrappers for N-API. The wrappers make it very much easier to create native addons.
N-API added capability for additional threads to invoke JavaScript functions based on the processing completed by those threads. Is there any timeline/plan to add wrappers for the same?
https://nodejs.org/docs/latest-v10.x/api/n-api.html#n_api_asynchronous_thread_safe_function_calls
Thank you
I'll take this issue if there is no one actively working on this.
Hello,
any news on this one ? I've discovered this project https://github.com/mika-fischer/napi-thread-safe-callback, it seems to have the same goal but use libuv directly to achieve it.
Ah, I missed this.. I'm on a trip now. I'll finish to implement this until next week.
How is the process going? It would be nice to get examples.
I tried to work on this issue for a while after a long vacation, but soon @DaAitch PR(#424) came up. I was too late and his PR looks reasonable to me. I believe he will finish the work soon. :)
@romandev I tought you're working on wrapping napi_threadsafe_function calls? I did not do that. I was working on a util method for making node calls from second thread easier.
@DaAitch Okay, thank you for explanation. I was lacking in understanding. I'll send a PR. Please review it when you have a spare time.
@romandev @mhdawson @gabrielschulhof
I think this needs some clarification now. Also in last Team meeting it was said, that I'm working on this which is not correct :grin: .
There is misunderstanding happening here. @romandev started working on a PR to land napi tsfn node-addon-api impl. I did not do that. I was working on an idea I started as WIP PR (#424), but which might never land. Only for the purpose to have some kind of documentation on things we tried out.
The reason why it looks like I did the tsfn implemention for node-addon-api is simply because the Napi::ThreadSafeFunction impl is missing and I need to use napi tsfn, so my "util" class uses napi tsfn directly. When the PR for this issues has landed, I can rewrite it.
So @romandev please go ahead with your PR on this. I think it would be good to land this soon because I'm also thinking that tsfn is a killer feature, so if you need help or want to hand it over please raise your hand.
Is this ready for release ?
@romandev Do you have an ETA on when this feature will be released?
Implement ThreadSafeFunction class
any plans on doing a release with this, now that the code and docs are merged?
Hi @DuBistKomisch,
you can track the tasks fro the new release in this issue https://github.com/nodejs/node-addon-api/issues/514
@romandev Great with this API (!) but are there any examples for how to use the API ?
@extmchristensen check out https://github.com/nodejs/node-addon-api/blob/master/doc/threadsafe_function.md#example
Most helpful comment
I'll take this issue if there is no one actively working on this.