-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: Context for custom async operations #15189
Conversation
- Add napi_async_context opaque pointer type. (If needed, we could later add APIs for getting the async IDs out of this context.) - Add napi_async_init() and napi_async_destroy() APIs. - Add async_context parameter to napi_make_callback(). - Add code and checks to test_make_callback to validate async context APIs by checking async hooks are called with correct context. - Update API documentation. Fixes: nodejs#13254
219e699
to
53de2e1
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.
Last N-API meeting we agreed to try to land all of the breaking changes together which I believe includes this one, as well so we should co-ordinate landing with the other breaking PRs. The goal is to have one final set of breaking changes. |
doc/api/n-api.md
Outdated
operation (when there is no other script on the stack). It is a fairly simple | ||
wrapper around `node::MakeCallback`. | ||
|
||
Note it is NOT necessary to use `napi_make_callback` from within a |
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.
s/NOT/*not*
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 a nit
As discussed for #15108, I need to change the string parameter of I also suggested a corresponding change to the string parameter of |
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.
still LGTM
Update:
|
There seem to be some linter errors https://ci.nodejs.org/job/node-test-commit/12275/ |
I pushed a commit to fix the lint issues. |
CI failure on ubuntu16 was a infra failure, not related to this PR. |
Arm failure was also a infra failure, not related to this PR. |
Looks like all of the breaking changes may be ready to go today (just watching #14697). Once it lands we'll land this and the other remaining breaking changes. |
#14697 landed, going to land this one. |
Landed as 0c258bd |
- Add napi_async_context opaque pointer type. (If needed, we could later add APIs for getting the async IDs out of this context.) - Add napi_async_init() and napi_async_destroy() APIs. - Add async_context parameter to napi_make_callback(). - Add code and checks to test_make_callback to validate async context APIs by checking async hooks are called with correct context. - Update API documentation. PR-URL: #15189 Fixes: #13254 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
- Add napi_async_context opaque pointer type. (If needed, we could later add APIs for getting the async IDs out of this context.) - Add napi_async_init() and napi_async_destroy() APIs. - Add async_context parameter to napi_make_callback(). - Add code and checks to test_make_callback to validate async context APIs by checking async hooks are called with correct context. - Update API documentation. PR-URL: nodejs/node#15189 Fixes: nodejs/node#13254 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
- Add napi_async_context opaque pointer type. (If needed, we could later add APIs for getting the async IDs out of this context.) - Add napi_async_init() and napi_async_destroy() APIs. - Add async_context parameter to napi_make_callback(). - Add code and checks to test_make_callback to validate async context APIs by checking async hooks are called with correct context. - Update API documentation. PR-URL: #15189 Fixes: #13254 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
- Add napi_async_context opaque pointer type. (If needed, we could later add APIs for getting the async IDs out of this context.) - Add napi_async_init() and napi_async_destroy() APIs. - Add async_context parameter to napi_make_callback(). - Add code and checks to test_make_callback to validate async context APIs by checking async hooks are called with correct context. - Update API documentation. PR-URL: nodejs/node#15189 Fixes: nodejs/node#13254 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
- Add napi_async_context opaque pointer type. (If needed, we could later add APIs for getting the async IDs out of this context.) - Add napi_async_init() and napi_async_destroy() APIs. - Add async_context parameter to napi_make_callback(). - Add code and checks to test_make_callback to validate async context APIs by checking async hooks are called with correct context. - Update API documentation. PR-URL: nodejs#15189 Fixes: nodejs#13254 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
- Add napi_async_context opaque pointer type. (If needed, we could later add APIs for getting the async IDs out of this context.) - Add napi_async_init() and napi_async_destroy() APIs. - Add async_context parameter to napi_make_callback(). - Add code and checks to test_make_callback to validate async context APIs by checking async hooks are called with correct context. - Update API documentation. Backport-PR-URL: #19447 PR-URL: #15189 Fixes: #13254 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
napi_async_context
opaque pointer type. (If needed, we could later add APIs for getting the async IDs out of this context.)napi_async_init()
andnapi_async_destroy()
APIs.async_context
parameter tonapi_make_callback()
.test_make_callback
to validate async context APIs by checking async hooks are called with correct context.Fixes: #13254
See also the related PR #14697 in which
napi_create_async_work()
is updated to automatically track async context. That PR together with this one make up the complete story for async context tracking with N-API.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
n-api