-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP]: src: implement NodeThreadScheduler
#424
Conversation
So I thought about, why not implementing it in the napi itself like this nodejs commit? |
@DaAitch AFAICT OTOH it should be possible to break TBH though the fact that we wish for this to be a single instance to be used by the entire addon for any number of reasons is beginning to turn this into a generic asynchronous queue implementation – which is perhaps what we really want, and which is perhaps what the base class will become. |
Okay, I thought according to the doc, when I
Okay yeah, I'm open to change impl details. I tried to just do it, get some feedback about maybe as
That's exactly where I started at 😆 , I tried a naive way and make So @gabrielschulhof what are your feelings about working on this? I'm happy to have |
I assume this is for #312? Looking forward to it! |
NodeThreadScheduler
NodeThreadScheduler
NodeThreadScheduler
NodeThreadScheduler
Discussed in the N-API team meeting today. Given that ThreadSafeFunction, function callback is optional and ThreadSafeFunction is available in all current LTS lines we believe we can close this. Closing let us know if that is not the right thing to do. |
This is a WIP PR.
Did some verbose commenting in the code as I was fixing some potential bugs/leaks from DaAitch/napi-experimental@412a466 as
napi_tsfn_abort
mode was used.This code should work, but I think we can do better.
I have a new idea of how we can get rid of heap allocation of
NodeThreadScheduler
, having it copyable, movable on the stack, thus feels more lightweight.I'll work on it soon.