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

n-api,doc: update doc regarding callback HandleScope/CallbackScope use #33893

Closed
gabrielschulhof opened this issue Jun 15, 2020 · 1 comment
Closed
Labels
doc Issues and PRs related to the documentations. node-api Issues and PRs related to the Node-API.

Comments

@gabrielschulhof
Copy link
Contributor

Explicitly state that HandleScope and CallbackScope declarations are not required inside AsyncWorker, ThreadsafeFunction et. al. callbacks.

Re: nodejs/node-addon-examples#142

@gabrielschulhof gabrielschulhof added doc Issues and PRs related to the documentations. node-api Issues and PRs related to the Node-API. labels Jun 15, 2020
@gabrielschulhof
Copy link
Contributor Author

It is tricky to express that opening a handle and/or callback scope is not necessary but opening a handle scope is still recommended if one is dealing with large numbers of JS values in the body of the callback.

gabrielschulhof pushed a commit to gabrielschulhof/node that referenced this issue Jun 23, 2020
Document that it is not necessary to open handle and/or callback scopes
inside finalizer, async work, thread-safe function etc. callbacks
unless for reasons documented in the section about object lifetime
management.

Link usage of callback signatures to their definition.

Fixes: nodejs#33893
MylesBorins pushed a commit that referenced this issue Jul 14, 2020
Document that it is not necessary to open handle and/or callback scopes
inside finalizer, async work, thread-safe function etc. callbacks
unless for reasons documented in the section about object lifetime
management.

Link usage of callback signatures to their definition.

Fixes: #33893
PR-URL: #33915
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
MylesBorins pushed a commit that referenced this issue Jul 16, 2020
Document that it is not necessary to open handle and/or callback scopes
inside finalizer, async work, thread-safe function etc. callbacks
unless for reasons documented in the section about object lifetime
management.

Link usage of callback signatures to their definition.

Fixes: #33893
PR-URL: #33915
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
addaleax pushed a commit that referenced this issue Sep 22, 2020
Document that it is not necessary to open handle and/or callback scopes
inside finalizer, async work, thread-safe function etc. callbacks
unless for reasons documented in the section about object lifetime
management.

Link usage of callback signatures to their definition.

Fixes: #33893
PR-URL: #33915
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. node-api Issues and PRs related to the Node-API.
Projects
None yet
Development

No branches or pull requests

1 participant