SLOG(LOG_INFO, TAG_TTSC, "[DEBUG] create pkgmgr thread");
pthread_mutex_lock(&g_pkgmgr_mutex);
+ int time_delay = 10000;
+ int cnt = 0;
while (NULL == g_pkgmgr) {
/* Checking the thread is canceled or not */
if (g_is_thread_canceled) {
g_pkgmgr = pkgmgr_client_new(PC_LISTENING);
if (NULL == g_pkgmgr) {
-// SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to create pkgmgr handle");
+ if (0 == cnt % 5) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to create pkgmgr handle");
+ time_delay *= 2;
+ }
} else {
int ret = pkgmgr_client_set_status_type(g_pkgmgr, PKGMGR_CLIENT_STATUS_INSTALL | PKGMGR_CLIENT_STATUS_UNINSTALL | PKGMGR_CLIENT_STATUS_UPGRADE);
if (0 == ret) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to listen pkgmgr status. remove and recreate client");
pkgmgr_client_free(g_pkgmgr);
g_pkgmgr = NULL;
+ if (0 == cnt % 5)
+ time_delay *= 2;
} else {
SLOG(LOG_ERROR, TAG_TTSC, "[INFO] Succeed to register pkgmgr cb");
break;
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to set status type on pkgmgr, ret(%d)", ret);
pkgmgr_client_free(g_pkgmgr);
g_pkgmgr = NULL;
+ if (0 == cnt % 5)
+ time_delay *= 2;
}
}
- usleep(10000);
+ usleep(time_delay);
+ cnt++;
}
pthread_mutex_unlock(&g_pkgmgr_mutex);