Check thread stop variable while waiting for audio data
authorJi-hoon Lee <dalton.lee@samsung.com>
Tue, 10 Sep 2019 02:53:13 +0000 (11:53 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Tue, 10 Sep 2019 10:15:12 +0000 (19:15 +0900)
Change-Id: I149436035de048426cd0e11b1e422cb663572508

plugins/wakeup-manager/src/wakeup_audio_manager.cpp
plugins/wakeup-manager/src/wakeup_engine_manager.cpp

index 2b6ae0f..74d53b0 100644 (file)
@@ -213,7 +213,7 @@ void CAudioManager::streaming_audio_data_thread_func(long start_time)
                        MWR_LOGD("[DEBUG] No feedback data. Waiting mode : %d", ret);
 
                        /* waiting */
-                       while (1) {
+                       while (!(mStopStreamingThread.load())) {
                                this_thread::sleep_for(chrono::milliseconds(10));
                                lock.lock();
                                end = mAudioData.end();
index 266d216..dc75571 100644 (file)
@@ -206,7 +206,7 @@ void CWakeupEngineManager::streaming_speech_data_thread_func()
                                MWR_LOGD("[DEBUG] No feedback data. Waiting mode : %d", ret);
 
                                /* waiting */
-                               while (1) {
+                               while (!(mStopStreamingThread.load())) {
                                        this_thread::sleep_for(chrono::milliseconds(10));
                                        if (index < interface->get_utterance_data_count()) {
                                                MWR_LOGI("[INFO] Resume thread");