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 da8f8afcb61fc262ca4b2cc410c8234c5b09f41a..589a2873212af248e5f2317833c49249c1855c1b 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 3f470c98a78c64aacfc4585de875634690c45003..23a1251fc48f52246894b44f4f7a830963d18522 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 d4470f9c268f7964008a3587898683b611874ad2..27b304ea28465daa44ba47127a61256a88d2a16f 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 359028eeb5f0b886d3c3ecb4162175a3654f773f..67bc455cebc5c2136444105f81cb47150d933526 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 78f3ba9fee33340523b61431396d75233c85f3c6..c5191e220135d4d6585fd9262f0a087f8df54f0e 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 cdab0c8fa457074e167ef9b73e881af46cf1cb72..5832c43327acf7ebaba6de18ebe6dafaaa5334cb 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 7c8b775f751f266ed7f703b7fa55704456b97c4a..4fec38990461f482c0f844b6b7d1df2496a1201d 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 6cfce0716a7624a8b8829d5e6589839c494fbf0b..5a8c3f577d2dc9a1ed7147a99181bb02fd5d51c9 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