@@ -771,7 +771,9 @@ typedef void (*napi_async_cleanup_hook)(napi_async_cleanup_hook_handle handle,
771771 void* data);
772772```
773773
774- * `[in] handle`: The handle obtained from [`napi_add_async_cleanup_hook`][].
774+ * `[in] handle`: The handle that must be passed to
775+ [`napi_remove_async_cleanup_hook`][] after completion of the asynchronous
776+ cleanup.
775777* `[in] data`: The data that was passed to [`napi_add_async_cleanup_hook`][].
776778
777779The body of the function should initiate the asynchronous cleanup actions at the
@@ -1626,24 +1628,22 @@ NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
16261628* `[in] env`: The environment that the API is invoked under.
16271629* `[in] hook`: The function pointer to call at environment teardown.
16281630* `[in] arg`: The pointer to pass to `hook` when it gets called.
1629- * `[out] remove_handle`: The handle that refers to the asynchronous cleanup
1630- hook. This handle must be passed to [`napi_remove_async_cleanup_hook`][] even if
1631- `hook` gets called.
1631+ * `[out] remove_handle`: Optional handle that refers to the asynchronous cleanup
1632+ hook.
16321633
16331634Registers `hook`, which is a function of type [`napi_async_cleanup_hook`][], as
16341635a function to be run with the `remove_handle` and `arg` parameters once the
16351636current Node.js environment exits.
16361637
1637- Unlike [`napi_add_env_cleanup_hook`][], the hook
1638- is allowed to be asynchronous, and must pass `remove_handle` in a call to
1639- [`napi_remove_env_cleanup_hook`][] once all asynchronous activity is finished.
1638+ Unlike [`napi_add_env_cleanup_hook`][], the hook is allowed to be asynchronous.
16401639
16411640Otherwise, behavior generally matches that of [`napi_add_env_cleanup_hook`][].
16421641
1643- An opaque value will be stored in `remove_handle` that must later be passed to
1644- [`napi_remove_async_cleanup_hook`][], regardless of whether the hook has already
1645- been invoked. Typically, that happens when the resource for which this hook was
1646- added is being torn down anyway.
1642+ If `remove_handle` is not `NULL`, an opaque value will be stored in it
1643+ that must later be passed to [`napi_remove_async_cleanup_hook`][],
1644+ regardless of whether the hook has already been invoked.
1645+ Typically, that happens when the resource for which this hook was added
1646+ is being torn down anyway.
16471647
16481648#### napi_remove_async_cleanup_hook
16491649<!-- YAML
0 commit comments