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

doc: fix wording in napi_async_init #49180

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5633,7 +5633,7 @@ problems like loss of async context when using the `AsyncLocalStorage` API.

In order to retain ABI compatibility with previous versions, passing `NULL`
for `async_resource` does not result in an error. However, this is not
recommended as this will result poor results with `async_hooks`
recommended as this will result in undesirable behavior with `async_hooks`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that in #32930, NULL is coerced to a newly created strong-referenced object to avoid breaking async_hooks.executionAsyncResource(). So it is not breaking async_hooks.executionAsyncResource() and AsyncLocalStorage, with the reason mentioned in the paragraph above.

As async_hooks.executionAsyncResource() is guaranteed to return a non-null object, it might be sufficient to state it is undefined behavior if the async_resource is NULL with the semantic conflicts.

[`init` hooks][] and `async_hooks.executionAsyncResource()` as the resource is
now required by the underlying `async_hooks` implementation in order to provide
the linkage between async callbacks.
Expand Down
Loading