temporary fix, wait for termination before proceeding update. 94/64494/2 accepted/tizen/common/20160401.171314 accepted/tizen/ivi/20160402.022203 accepted/tizen/mobile/20160402.022136 accepted/tizen/tv/20160402.022145 accepted/tizen/wearable/20160402.022156 submit/tizen/20160401.130236
authorjongmyeongko <jongmyeong.ko@samsung.com>
Fri, 1 Apr 2016 11:29:35 +0000 (20:29 +0900)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Fri, 1 Apr 2016 11:51:04 +0000 (04:51 -0700)
Change-Id: I37a4dbbc7b6cb8738e65533564f973c751cbd898
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/common/step/pkgmgr/step_kill_apps.cc

index b6f308e..53a00db 100644 (file)
@@ -8,6 +8,7 @@
 #include <app_manager_extension.h>
 
 #include <string>
+#include <sys/time.h>
 
 #include "common/utils/glist_range.h"
 
@@ -35,6 +36,22 @@ bool KillApp(const std::string& appid) {
     app_context_destroy(app_context);
     return false;
   }
+
+  // temporary fix, check running status again
+  for (int i = 0; i < 10; i++) {
+    if (app_manager_is_running(appid.c_str(), &is_running)
+      != APP_MANAGER_ERROR_NONE)
+      LOG(ERROR) << "app_manager_is_running failed, check again!";
+
+    if (!is_running) {
+      LOG(DEBUG) << "kill waiting count (" << i << ")";
+      break;
+    }
+    usleep(100000); // 100msec
+    if (i == 10)
+      LOG(ERROR) << "kill timeout";
+  }
+
   LOG(DEBUG) << "Application '" << appid << "' has been killed";
   app_context_destroy(app_context);
   return true;