Register a callback that will be invoked when the last shutdown function is called.
BPS_API int bps_register_shutdown_handler(void(*shutdown_handler)(void *), void *data)
The function for platform services to call when the library is shutting down. BPS passes the data that the caller provided as the first argument.
The user data that is passed as the first argument when the BPS calls the shutdown handler.
Shutdown handlers/callbacks are called when bps_shutdown() is called for the last time. BPS tracks how many times bps_initialize() has been called, and when bps_shutdown() has been called the same number of times (i.e., a reference count drops to 0), the shutdown handlers are called.
This function cleans up a service's global data. Typically, a service has to reset the domain ID to indicate it has been uninitialized. Other cleanup activities depend on the service's implementation.
BPS_SUCCESS is returned if the handler registered successfully with the data, BPS_FAILURE with errno value set otherwise.