emulator: shutdown immediately
authorGiWoong Kim <giwoong.kim@samsung.com>
Fri, 26 Jul 2013 08:17:52 +0000 (17:17 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Mon, 29 Jul 2013 02:43:00 +0000 (11:43 +0900)
shutdown immediately when shutdown_qemu_gracefully
function was called twice by terminate signal

Change-Id: I681fc0741a39faf67936d8e60e019f32487b7c63
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/maruskin_operation.c

index 9049f07b3a421785e91c4022c98e0d2bd38f69b5..abb33af562fdeb931b31f3e2713eda1174b163a8 100644 (file)
@@ -86,8 +86,10 @@ void start_display(uint64 handle_id,
     int lcd_size_width, int lcd_size_height,
     double scale_factor, short rotation_type)
 {
-    INFO("start_display handle_id:%ld, lcd size:%dx%d, scale_factor:%f, rotation_type:%d\n",
-        (long)handle_id, lcd_size_width, lcd_size_height, scale_factor, rotation_type);
+    INFO("start_display handle_id:%ld, lcd size:%dx%d, \
+            scale_factor:%f, rotation_type:%d\n",
+        (long) handle_id, lcd_size_width, lcd_size_height,
+        scale_factor, rotation_type);
 
     set_emul_win_scale(scale_factor);
     maruskin_init(handle_id, lcd_size_width, lcd_size_height, false);
@@ -558,21 +560,27 @@ void request_close(void)
 #endif
 
     do_hardkey_event(KEY_RELEASED, HARD_KEY_POWER);
-
 }
 
 void shutdown_qemu_gracefully(void)
 {
-    requested_shutdown_qemu_gracefully = 1;
+    if (is_requested_shutdown_qemu_gracefully() != 1) {
+        requested_shutdown_qemu_gracefully = 1;
+
+        INFO("shutdown_qemu_gracefully was called\n");
 
-    pthread_t thread_id;
-    if (0 > pthread_create(
-        &thread_id, NULL, run_timed_shutdown_thread, NULL)) {
+        pthread_t thread_id;
+        if (0 > pthread_create(
+            &thread_id, NULL, run_timed_shutdown_thread, NULL)) {
 
-        ERR("!!! Fail to create run_timed_shutdown_thread. shutdown qemu right now !!!\n");
+            ERR("!!! Fail to create run_timed_shutdown_thread. \
+                shutdown qemu right now !!!\n");
+            qemu_system_shutdown_request();
+        }
+    } else {
+        INFO("shutdown_qemu_gracefully was called twice\n");
         qemu_system_shutdown_request();
     }
-
 }
 
 int is_requested_shutdown_qemu_gracefully(void)
@@ -602,7 +610,6 @@ static void* run_timed_shutdown_thread(void* args)
     qemu_system_shutdown_request();
 
     return NULL;
-
 }
 
 static void send_to_emuld(const char* request_type,