Skip to content
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

Replace libuv usage with napi_async_work? #96

Closed
littledivy opened this issue Feb 3, 2022 · 2 comments · Fixed by #146
Closed

Replace libuv usage with napi_async_work? #96

littledivy opened this issue Feb 3, 2022 · 2 comments · Fixed by #146

Comments

@littledivy
Copy link

littledivy commented Feb 3, 2022

Hi! I'm working on a N-API implementation on top of deno_core and Tokio (https://github.com/littledivy/napi-rusty-v8/) and we're trying to get all of parcel's native modules to work. The implementation is eventually going to be merged in Deno.

Since this is built on top of Tokio, we're avoiding to expose libuv polyfills. This makes @parcel/watcher incompatible. Would it be possible to use napi_async_work instead of libuv for the Watcher?

@devongovett
Copy link
Member

Last I checked (which was a few years ago, so may have changed), there was no equivalent of uv_async_send as used here:

uv_async_send(mAsync);

This is different from napi_async_work, because we execute a JS callback multiple times. We use uv_async_send to call into the JS thread from a background thread where watching is occurring.

Are you aware of a way to do this with napi?

@littledivy
Copy link
Author

Oh yeah, for uv_async_t there is Napi::ThreadSafeFunction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants