Add retry cnt for fail to get running app info
authorJunghyun Kim <jh1114.kim@samsung.com>
Tue, 11 Sep 2012 07:23:57 +0000 (16:23 +0900)
committerJunghyun Kim <jh1114.kim@samsung.com>
Tue, 11 Sep 2012 07:26:37 +0000 (16:26 +0900)
Change-Id: Id03afb72ad6bd5cf203891f7c1fb58faa52c4d4e

src/_genlist.c

index 480db80..43089d5 100755 (executable)
@@ -679,13 +679,21 @@ void _set_genlist(struct appdata *ad)
 _D("func\n");
        retm_if(ad == NULL, "Invalid argument: appdata is NULL\n");
        int ret = AUL_R_ERROR;
+       int retry_cnt = 0;
+       int sleep_value = 1000;
 
        _init_grp_cnt();
 
-       ret = aul_app_get_running_app_info(runapp_info_get, ad);
+       while (ret != AUL_R_OK && retry_cnt < 5) {
+               usleep(sleep_value);
+               ret = aul_app_get_running_app_info(runapp_info_get, ad);
 
-       if (ret != AUL_R_OK) {
-               _D("Fail to get running app information from ail");
+               if (ret != AUL_R_OK) {
+                       _D("Fail to get running app information from ail");
+               }
+
+               retry_cnt++;
+               sleep_value *= 2;
        }
 
        taskmanager_get_history_app_info(ad);