Add a checker of thread cancellation 30/245830/1 submit/tizen/20201019.010445
authorsooyeon.kim <sooyeon.kim@samsung.com>
Fri, 16 Oct 2020 09:14:33 +0000 (18:14 +0900)
committersooyeon.kim <sooyeon.kim@samsung.com>
Fri, 16 Oct 2020 09:14:33 +0000 (18:14 +0900)
Change-Id: I27461ca02fdf82b55aa2785b1f32da02e6424621
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
client/tts.c

index f8f1862..efd5fd8 100644 (file)
@@ -355,6 +355,12 @@ static void __create_pkgmgr_thread(void* data, Ecore_Thread* thread)
                }
                usleep(10000);
 
+               /* Checking the thread is canceled or not */
+               if (ecore_thread_check(g_pkgmgr_thread)) {
+                       SLOG(LOG_WARN, TAG_TTSC, "[WARNING] g_pkgmgr_thread is canceled. Exit");
+                       break;
+               }
+
                /* Checking handle which can be destroyed on other thread */
                if (false == tts_client_is_valid(tts)) {
                        SLOG(LOG_INFO, TAG_TTSC, "[INFO] client is already destroyed");
@@ -2659,6 +2665,12 @@ static void __start_reprepare_thread(void* data, Ecore_Thread* thread)
 
                usleep(50000);
                cnt++;
+
+               /* Checking thread is canceled or not */
+               if (ecore_thread_check(client->thread)) {
+                       SLOG(LOG_WARN, TAG_TTSC, "[WARNING] client thread is canceled. Exit");
+                       return;
+               }
        }
 
        SLOG(LOG_ERROR, TAG_TTSC, "[DEBUG] update status(%d)", g_engine_update_status);
@@ -2671,6 +2683,12 @@ static void __start_reprepare_thread(void* data, Ecore_Thread* thread)
                }
 
                usleep(200000);
+
+               /* Checking thread is canceled or not */
+               if (ecore_thread_check(client->thread)) {
+                       SLOG(LOG_WARN, TAG_TTSC, "[WARNING] client thread is canceled. Exit");
+                       return;
+               }
        }
 
        SLOG(LOG_INFO, TAG_TTSC, "[INFO] finish updating. request to prepare");