Add cancel callback feedback thread 74/284174/2
authorSuyeon Hwang <stom.hwang@samsung.com>
Thu, 10 Nov 2022 09:00:21 +0000 (18:00 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Wed, 28 Dec 2022 08:16:40 +0000 (17:16 +0900)
- Issue:
Sometimes, ecore_thread_cancel() is blocked in vc_mgr_stop_feedback().

- Solution:
In vc_mgr_stop_feedback(), ecore_thread_cancel() is used, but the cancel
callback is not set. Thus, this patch adds cancel callback and makes the
callback reset the thread variable. Through this patch, the thread
variable will be safely reset.

Change-Id: I926c52aec385b07da65dbf1f6b363eeec328acdd
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
client/vc_mgr.c

index 0de3b92..cdb0a25 100644 (file)
@@ -3488,6 +3488,12 @@ static void __end_tts_feedback_thread(void* data, Ecore_Thread* thread)
        g_feedback_thread = NULL;
 }
 
+static void __cancel_tts_feedback_thread(void* data, Ecore_Thread* thread)
+{
+       SLOG(LOG_INFO, TAG_VCM, "[SUCCESS] Cancel thread");
+       g_feedback_thread = NULL;
+}
+
 int vc_mgr_start_feedback(void)
 {
        SLOG(LOG_INFO, TAG_VCM, "@@@ [Manager] start feedback");
@@ -3512,7 +3518,7 @@ int vc_mgr_start_feedback(void)
        bool is_exist = ecore_thread_check(g_feedback_thread);
        if (NULL == g_feedback_thread || TRUE == is_exist) {
                SLOG(LOG_INFO, TAG_VCM, "[INFO] ecore thread run : __tts_feedback_thread");
-               g_feedback_thread = ecore_thread_run(__tts_feedback_thread, __end_tts_feedback_thread, NULL, NULL);
+               g_feedback_thread = ecore_thread_run(__tts_feedback_thread, __end_tts_feedback_thread, __cancel_tts_feedback_thread, NULL);
        }
 #else
        /* start playing TTS feedback */