/** * Internally used thread function. */ void* np_notifier( void* arg ) { char *notification = NULL; struct np_thread *npt = (struct np_thread*)arg; if (!npt) return NULL; debug_info("starting callback."); while (npt->client->parent) { if (np_get_notification(npt->client, ¬ification) < 0) { npt->cbfunc("", npt->user_data); break; } if (notification) { npt->cbfunc(notification, npt->user_data); free(notification); notification = NULL; } sleep(1); } if (npt) { free(npt); } return NULL; }
/** * Internally used thread function. */ gpointer np_notifier( gpointer arg ) { char *notification = NULL; struct np_thread *npt = (struct np_thread*)arg; if (!npt) return NULL; log_debug_msg("%s: starting callback.\n", __func__); while (npt->client->connection) { np_get_notification(npt->client, ¬ification); if (notification) { npt->cbfunc(notification); free(notification); notification = NULL; } sleep(1); } if (npt) { free(npt); } return NULL; }