Function TVMFFIHandleDeinitOnce#
Defined in File c_api.h
Function Documentation#
-
int TVMFFIHandleDeinitOnce(void **handle_addr, int (*deinit_func)(void *handle))#
Deinitialize a handle once in a thread-safe manner.
This function checks if *handle_addr is not nullptr, and if so, calls the deinitialization function and sets *handle_addr to nullptr.
This function is thread-safe and is meant to be used by DSLs that, unlike C++, may not have static deinitialization support.
- Parameters:
handle_addr – The address of the handle to be deinitialized.
deinit_func – The deinitialization function to be called if *handle_addr is not nullptr.
- Returns:
0 on success, nonzero on failure.