pub unsafe extern "C" fn AServiceManager_setActiveServicesCallback(
    callback: Option<unsafe extern "C" fn(arg1: bool, arg2: *mut c_void) -> bool>,
    context: *mut c_void,
)
Expand description

Set a callback that is invoked when the active service count (i.e. services with clients) registered with this process drops to zero (or becomes nonzero). The callback takes a boolean argument, which is ‘true’ if there is at least one service with clients.

\param callback function to call when the number of services with clients changes. \param context opaque pointer passed back as second parameter to the callback.

The callback takes two arguments. The first is a boolean that represents if there are services with clients (true) or not (false). The second is the ‘context’ pointer passed during the registration.

Callback return value:

  • false: Default behavior for lazy services (shut down the process if there are no clients).
  • true: Don’t shut down the process even if there are no clients.

This callback gives a chance to: 1 - Perform some additional operations before exiting; 2 - Prevent the process from exiting by returning “true” from the callback.