From e9767bfdb15a79f6e96d78352987ecb95d6876d6 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 16 Oct 2020 18:14:33 +0900 Subject: [PATCH] Add a checker of thread cancellation Change-Id: I27461ca02fdf82b55aa2785b1f32da02e6424621 Signed-off-by: sooyeon.kim --- client/tts.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/client/tts.c b/client/tts.c index f8f1862..efd5fd8 100644 --- a/client/tts.c +++ b/client/tts.c @@ -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"); -- 2.7.4