-
Notifications
You must be signed in to change notification settings - Fork 30k
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: document nextTick timing in callbacks #33804
Conversation
91b6970
to
f457dd0
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.
lgtm
f457dd0
to
96d65ba
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.
👍 Overall LGTM. Please address the issue that lint complains.
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.
LGTM with the linter warning addressed – and the linter complaint is correct, this isn’t a side effect of the function but rather half its purpose :)
96d65ba
to
e848bb4
Compare
Updated the message |
@@ -4755,6 +4755,9 @@ is sufficient and appropriate. Use of the `napi_make_callback` function | |||
may be required when implementing custom async behavior that does not use | |||
`napi_create_async_work`. | |||
|
|||
Any `process.nextTick`s or Promises scheduled on the microtask queue by | |||
JavaScript during the callback are ran before returning back to C/C++. |
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.
JavaScript during the callback are ran before returning back to C/C++. | |
JavaScript during the callback are run before returning back to C/C++. |
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.
Better perhaps?
JavaScript during the callback are ran before returning back to C/C++. | |
JavaScript during the callback are executed before returning back to C/C++. |
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.
LGTM with fixes suggested by @gabrielschulhof
PR-URL: #33804 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Landed in 50fb019 |
PR-URL: #33804 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
PR-URL: #33804 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
PR-URL: #33804 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
PR-URL: #33804 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesDocument that nextTicks when c/c++ calls js are ran before returning to c/c++ if any are scheduled by the js callback. Just fixed a bug in Electron related to this, so thought we could help others avoid this quirk by making it more clear.