diff options
author | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2020-08-17 20:13:00 +0300 |
---|---|---|
committer | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2020-08-27 18:18:37 +0300 |
commit | 0848f56cb39432090cdb99af9b8541fbc1a2849c (patch) | |
tree | 12f0089eba17afcaa39a03de6482dd1a221e3b2e /src/node_api.h | |
parent | 3089f96ed01653aa4d5e4bba5a5db473ffe788a0 (diff) |
n-api: re-implement async env cleanup hooks
* Avoid passing core `void*` and function pointers into add-on.
* Document `napi_async_cleanup_hook_handle` type.
* Render receipt of the handle mandatory from the point where the
hook gets called. Removal of the handle remains mandatory.
Fixes: https://github.com/nodejs/node/issues/34715
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
Co-authored-by: Anna Henningsen <github@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/34819
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Diffstat (limited to 'src/node_api.h')
-rw-r--r-- | src/node_api.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/node_api.h b/src/node_api.h index 4f3eb8f2caa..577a1dcd949 100644 --- a/src/node_api.h +++ b/src/node_api.h @@ -254,12 +254,11 @@ napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func); NAPI_EXTERN napi_status napi_add_async_cleanup_hook( napi_env env, - void (*fun)(void* arg, void(* cb)(void*), void* cbarg), + napi_async_cleanup_hook hook, void* arg, napi_async_cleanup_hook_handle* remove_handle); NAPI_EXTERN napi_status napi_remove_async_cleanup_hook( - napi_env env, napi_async_cleanup_hook_handle remove_handle); #endif // NAPI_EXPERIMENTAL |