-
Notifications
You must be signed in to change notification settings - Fork 289
Threadsafe Handles #622
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
Threadsafe Handles #622
Conversation
a047c64
to
30fac9e
Compare
23b671d
to
e67b1d1
Compare
e67b1d1
to
ab9ff25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome. I made a few suggestions but I'll leave them all to your discretion.
src/task/event_queue.rs
Outdated
@@ -0,0 +1,161 @@ | |||
use neon_runtime::raw::Env; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
All possible combinations of added feature flags were tested to ensure the code compiles without unused warnings: cargo check && cargo check --features event-handler-api && cargo check --no-default-features --features napi-1 && cargo check --no-default-features --features napi-4 && cargo check && cargo check --no-default-features --features napi-4,event-queue-api && cargo check --no-default-features --features napi-1,event-queue-api && cargo check --no-default-features --features napi-4,event-handler-api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. One suggestion for a clearer failure message if someone tries to use the deprecated EventHandler API with N-API.
src/event/event_handler.rs
Outdated
impl EventHandler { | ||
#[cfg(feature = "napi-1")] | ||
pub fn new<'a, C: Context<'a>, T: Value>(cx: &C, this: Handle<T>, callback: Handle<JsFunction>) -> Self { | ||
unimplemented!() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe include a panic message that explains that this experimental API is not supported in the N-API backend, with a suggestion for an alternative.
Thank you very much for merging this PR!
It got released two days ago! Thank you! |
@demurgos Yep! It's on neon = { version = "0.7", default-features = false, features = ["napi-4", "event-queue-api"] } It's behind an additional feature flag because the API won't be considered stable until the RFC is merged. Here are the API docs: https://docs.rs/neon/0.7.0-napi.3/neon/event/struct.EventQueue.html |
Implementation of neon-bindings/rfcs#32