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

[question] Pass AbortSignal.aborted to C Code #1631

Open
dormeiri opened this issue Jan 27, 2025 · 1 comment
Open

[question] Pass AbortSignal.aborted to C Code #1631

dormeiri opened this issue Jan 27, 2025 · 1 comment

Comments

@dormeiri
Copy link

Not sure if it is the right place...

I’m working with an AbortSignal and some C code (extern "C"). I need to pass a reference to AbortSignal.aborted (a boolean) to the C code, which runs async work.

Right now, I’m using a bool pointer and an addEventListener to update the value, but this hurts performance. Is there a way to directly reference aborted?

Thanks!

@dormeiri dormeiri changed the title [question] accessing boolean napi_value from C (by reference) [question] Pass AbortSignal.aborted to C Code Jan 27, 2025
@KevinEady
Copy link
Contributor

Could you use a property accessor? Create an Object in C++ that has an accessor (which is a function) that returns a Boolean::New(env, AbortSignal.aborted ) ?

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

No branches or pull requests

2 participants