menu: reduce Force Close delay time 82/36082/3
authorGiWoong Kim <giwoong.kim@samsung.com>
Mon, 2 Mar 2015 04:45:02 +0000 (13:45 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 4 Mar 2015 07:12:27 +0000 (23:12 -0800)
10s -> 1s

Change-Id: I695dc6a5347fd0ea290876dcc6833fd1cc172ed4
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/maruskin_client.c
tizen/src/skin/maruskin_operation.c
tizen/src/skin/maruskin_operation.h
tizen/src/skin/maruskin_server.c
tizen/src/ui/mainwindow.cpp
tizen/src/ui/menu/contextmenu.cpp
ui/input.c
vl.c

index da8f8af..589a287 100644 (file)
@@ -278,7 +278,7 @@ static void *run_skin_client(void *arg)
         if (dwRet != 0) {
             /* child process is terminated with some problem.
             So qemu process will terminate, too. immediately. */
-            shutdown_qemu_gracefully();
+            shutdown_qemu_gracefully(TIMEOUT_FOR_SHUTDOWN);
         }
 
         if (CloseHandle(pi.hProcess) != 0) {
@@ -304,7 +304,7 @@ static void *run_skin_client(void *arg)
         if (ret != 0) {
             /* child process is terminated with some problem.
             So qemu process will terminate, too. immediately. */
-            shutdown_qemu_gracefully();
+            shutdown_qemu_gracefully(TIMEOUT_FOR_SHUTDOWN);
         }
     }
 
index 3f470c9..23a1251 100644 (file)
@@ -63,7 +63,6 @@ MULTI_DEBUG_CHANNEL(qemu, skin_op);
 #define RESUME_KEY_SEND_INTERVAL 500 /* milli-seconds */
 #define CLOSE_POWER_KEY_INTERVAL 1200 /* milli-seconds */
 #define DATA_DELIMITER "#" /* in detail info data */
-#define TIMEOUT_FOR_SHUTDOWN 10 /* seconds */
 
 static int requested_shutdown_qemu_gracefully = 0;
 
@@ -621,15 +620,15 @@ void request_close(void)
     maru_display_update();
 }
 
-void shutdown_qemu_gracefully(void)
+void shutdown_qemu_gracefully(unsigned int sec)
 {
     if (is_requested_shutdown_qemu_gracefully() != 1) {
         requested_shutdown_qemu_gracefully = 1;
 
         INFO("shutdown_qemu_gracefully was called\n");
         QemuThread thread_id;
-        qemu_thread_create(&thread_id, "shutdown_thread", run_timed_shutdown_thread,
-                           NULL, QEMU_THREAD_DETACHED);
+        qemu_thread_create(&thread_id, "shutdown_thread",
+            run_timed_shutdown_thread, (void *)sec, QEMU_THREAD_DETACHED);
     } else {
         INFO("shutdown_qemu_gracefully was called twice\n");
         qemu_system_shutdown_request();
@@ -645,10 +644,11 @@ static void* run_timed_shutdown_thread(void* args)
 {
     send_shutdown_to_emuld();
 
-    int sleep_interval_time = 1000; /* milli-seconds */
+    const int sleep_interval_time = 1000; /* milli-seconds */
+    const int timeout_for_shutdown = (const int)args;
 
     int i;
-    for (i = 0; i < TIMEOUT_FOR_SHUTDOWN; i++) {
+    for (i = 0; i < timeout_for_shutdown; i++) {
 #ifdef CONFIG_WIN32
         Sleep(sleep_interval_time);
 #else
index d4470f9..27b304e 100644 (file)
@@ -34,6 +34,8 @@
 
 extern int ret_hax_init;
 
+#define TIMEOUT_FOR_SHUTDOWN 10 /* seconds */
+
 typedef struct Framebuffer {
     unsigned char* data;
     unsigned int data_length;
@@ -70,7 +72,7 @@ void do_ram_dump(void);
 void do_guestmemory_dump(void);
 
 void request_close(void);
-void shutdown_qemu_gracefully(void);
+void shutdown_qemu_gracefully(unsigned int sec);
 int is_requested_shutdown_qemu_gracefully(void);
 
 #endif /* MARUSKIN_OPERATION_H_ */
index 359028e..67bc455 100644 (file)
@@ -597,7 +597,7 @@ static void* run_skin_server(void* args)
         perror("create listen socket error : ");
 
         print_fail_log();
-        shutdown_qemu_gracefully();
+        shutdown_qemu_gracefully(TIMEOUT_FOR_SHUTDOWN);
 
         return NULL;
     }
@@ -622,7 +622,7 @@ static void* run_skin_server(void* args)
         }
 
         print_fail_log();
-        shutdown_qemu_gracefully();
+        shutdown_qemu_gracefully(TIMEOUT_FOR_SHUTDOWN);
 
         return NULL;
     }
@@ -650,7 +650,7 @@ static void* run_skin_server(void* args)
         }
 
         print_fail_log();
-        shutdown_qemu_gracefully();
+        shutdown_qemu_gracefully(TIMEOUT_FOR_SHUTDOWN);
 
         return NULL;
     }
@@ -1157,7 +1157,7 @@ static void* run_skin_server(void* args)
 
     if (shutdown_qemu) {
         print_fail_log();
-        shutdown_qemu_gracefully();
+        shutdown_qemu_gracefully(TIMEOUT_FOR_SHUTDOWN);
     }
 
     return NULL;
@@ -1413,7 +1413,7 @@ static void* do_heart_beat(void* args)
         ERR("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
 
         maru_register_exit_msg(MARU_EXIT_HB_TIME_EXPIRED, NULL);
-        shutdown_qemu_gracefully();
+        shutdown_qemu_gracefully(TIMEOUT_FOR_SHUTDOWN);
     }
 
     return NULL;
index 78f3ba9..c5191e2 100644 (file)
@@ -409,7 +409,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
                                  QMessageBox::No);
     if (r == QMessageBox::Yes) {
         /* force close */
-        shutdown_qemu_gracefully();
+        shutdown_qemu_gracefully(TIMEOUT_FOR_SHUTDOWN);
     } else {
         event->ignore();
     }
index cdab0c8..5832c43 100644 (file)
@@ -761,7 +761,7 @@ void ContextMenu::slotForceCloseSelected(QAbstractButton *btn)
     if (btn->text().compare("&Yes") == 0) {
         qDebug() << "exit!";
         /* force close */
-        shutdown_qemu_gracefully();
+        shutdown_qemu_gracefully(1);
     } else {
         qDebug() << "cancel";
     }
index 7c8b775..4fec389 100644 (file)
@@ -12,7 +12,7 @@
 extern void maru_hwkey_event(int event_type, int keycode);
 extern void do_rotation_event(int rotation_type);
 extern void do_host_kbd_enable(bool on);
-extern void shutdown_qemu_gracefully(void);
+extern void shutdown_qemu_gracefully(unsigned int sec);
 extern void request_close(void);
 void* tizen_close_thread(void* data);
 #endif
@@ -544,7 +544,7 @@ void* tizen_close_thread(void* type)
 
     if (data == 1) {
         /* force close */
-        shutdown_qemu_gracefully();
+        shutdown_qemu_gracefully(10);
     } else {
         request_close();
     }
diff --git a/vl.c b/vl.c
index 6cfce07..5a8c3f5 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -1836,7 +1836,7 @@ void qemu_system_killed(int signal, pid_t pid)
     no_shutdown = 0;
 
 #ifdef CONFIG_MARU
-    shutdown_qemu_gracefully();
+    shutdown_qemu_gracefully(TIMEOUT_FOR_SHUTDOWN);
 #else
     qemu_system_shutdown_request();
 #endif