napi_finalize


附加组件提供的函数的函数指针类型,允许用户在垃圾收集周期完成后安排一组对 Node-API 的调用,以响应垃圾收集事件。这些函数指针可与 node_api_post_finalizer 一起使用。

¥Function pointer type for add-on provided function that allow the user to schedule a group of calls to Node-APIs in response to a garbage collection event, after the garbage collection cycle has completed. These function pointers can be used with node_api_post_finalizer.

typedef void (*napi_finalize)(napi_env env,
                              void* finalize_data,
                              void* finalize_hint); 

变更历史:

¥Change History:

  • 实验性的(定义了 NAPI_EXPERIMENTAL):

    ¥experimental (NAPI_EXPERIMENTAL is defined):

    这种类型的函数不能再用作终结器,node_api_post_finalizer 除外。必须使用 node_api_nogc_finalize 来代替。可以通过定义 NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT 来关闭此功能。

    ¥A function of this type may no longer be used as a finalizer, except with node_api_post_finalizer. node_api_nogc_finalize must be used instead. This feature can be turned off by defining NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT.