Register a callback that will be invoked when the active channel is being destroyed.
#include <bps/bps.h>
BPS_API int bps_register_channel_destroy_handler(void(*destroy_handler)(void *),
void *data)
BlackBerry 10.0.0
The callback that is invoked on channel destruction.
The user data that is passed to the destroy_handler.
The function is used for services that have channel specific resources allocated that require cleanup when the channel is destroyed. At a minimum, most services have at least one file descriptor that needs to be closed.
The destroy_handler is invoked when the channel is destroyed and the user data is passed into the function as the first argument. In the destroy_handler, do not call BPS library functions that use the channel that is being destroyed, with the exception of the bps_get_domain_data() function.
BPS_SUCCESS when the handler has successfully been registered along with the data, BPS_FAILURE with errno value set otherwise.