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

No ability to compare ThreadSafeFunction and Function #881

Closed
kuzenko opened this issue Jan 20, 2021 · 3 comments
Closed

No ability to compare ThreadSafeFunction and Function #881

kuzenko opened this issue Jan 20, 2021 · 3 comments
Labels

Comments

@kuzenko
Copy link

kuzenko commented Jan 20, 2021

As I see now there is not possibility to compare these two types (Function inherits Value, and ThreadSafeFunction don't), are there any solutions for that? Thanks.

@KevinEady
Copy link
Contributor

Hi @kuzenko ,

You are correct. A Napi::Function holds a napi_value, whereas a Napi::ThreadSafeFunction holds a napi_threadsafe_function. They are inherently different, and you cannot compare them. Furthermore, not all TSFNs are created with a function passed to them: starting with N-API 5, the function parameter is optional.

If you want to compare the types, you will have to manually keep track of the Function passed to TSFN::New and compare that value instead.

Hope this helps.

@github-actions
Copy link
Contributor

This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.

@github-actions github-actions bot added the stale label Apr 22, 2021
@mhdawson
Copy link
Member

There has been no additional questions since @KevinEady answered, closing. Please let us know if you think that was not the right thing to do.

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

No branches or pull requests

3 participants