yangjun
Committed by GitHub

Fix ctrl+c may lead to coredump (#2511)

@@ -135,6 +135,7 @@ us_silver.json @@ -135,6 +135,7 @@ us_silver.json
135 kokoro-multi-lang-v1_0 135 kokoro-multi-lang-v1_0
136 sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16 136 sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16
137 cmake-build-debug 137 cmake-build-debug
  138 +cmake-build-release
138 README-DEV.txt 139 README-DEV.txt
139 *.rknn 140 *.rknn
140 *.jit 141 *.jit
@@ -165,6 +165,9 @@ int32_t main() { @@ -165,6 +165,9 @@ int32_t main() {
165 while (samples_queue.empty() && !stop) { 165 while (samples_queue.empty() && !stop) {
166 condition_variable.wait(lock); 166 condition_variable.wait(lock);
167 } 167 }
  168 + if (stop) {
  169 + break;
  170 + }
168 171
169 const auto &s = samples_queue.front(); 172 const auto &s = samples_queue.front();
170 if (!resampler.Get()) { 173 if (!resampler.Get()) {
@@ -172,6 +172,9 @@ int32_t main() { @@ -172,6 +172,9 @@ int32_t main() {
172 while (samples_queue.empty() && !stop) { 172 while (samples_queue.empty() && !stop) {
173 condition_variable.wait(lock); 173 condition_variable.wait(lock);
174 } 174 }
  175 + if (stop) {
  176 + break;
  177 + }
175 178
176 const auto &s = samples_queue.front(); 179 const auto &s = samples_queue.front();
177 if (!resampler.Get()) { 180 if (!resampler.Get()) {
@@ -172,6 +172,9 @@ as the device_name. @@ -172,6 +172,9 @@ as the device_name.
172 while (samples_queue.empty() && !stop) { 172 while (samples_queue.empty() && !stop) {
173 condition_variable.wait(lock); 173 condition_variable.wait(lock);
174 } 174 }
  175 + if (stop) {
  176 + break;
  177 + }
175 178
176 const auto &s = samples_queue.front(); 179 const auto &s = samples_queue.front();
177 buffer.insert(buffer.end(), s.begin(), s.end()); 180 buffer.insert(buffer.end(), s.begin(), s.end());
@@ -167,6 +167,10 @@ int32_t main() { @@ -167,6 +167,10 @@ int32_t main() {
167 condition_variable.wait(lock); 167 condition_variable.wait(lock);
168 } 168 }
169 169
  170 + if (stop) {
  171 + break;
  172 + }
  173 +
170 const auto &s = samples_queue.front(); 174 const auto &s = samples_queue.front();
171 if (!resampler.Get()) { 175 if (!resampler.Get()) {
172 buffer.insert(buffer.end(), s.begin(), s.end()); 176 buffer.insert(buffer.end(), s.begin(), s.end());
@@ -170,6 +170,9 @@ as the device_name. @@ -170,6 +170,9 @@ as the device_name.
170 while (samples_queue.empty() && !stop) { 170 while (samples_queue.empty() && !stop) {
171 condition_variable.wait(lock); 171 condition_variable.wait(lock);
172 } 172 }
  173 + if (stop) {
  174 + break;
  175 + }
173 176
174 const auto &s = samples_queue.front(); 177 const auto &s = samples_queue.front();
175 buffer.insert(buffer.end(), s.begin(), s.end()); 178 buffer.insert(buffer.end(), s.begin(), s.end());
@@ -164,6 +164,9 @@ int32_t main() { @@ -164,6 +164,9 @@ int32_t main() {
164 while (samples_queue.empty() && !stop) { 164 while (samples_queue.empty() && !stop) {
165 condition_variable.wait(lock); 165 condition_variable.wait(lock);
166 } 166 }
  167 + if (stop) {
  168 + break;
  169 + }
167 170
168 const auto &s = samples_queue.front(); 171 const auto &s = samples_queue.front();
169 if (!resampler.Get()) { 172 if (!resampler.Get()) {
@@ -172,6 +172,9 @@ int32_t main() { @@ -172,6 +172,9 @@ int32_t main() {
172 while (samples_queue.empty() && !stop) { 172 while (samples_queue.empty() && !stop) {
173 condition_variable.wait(lock); 173 condition_variable.wait(lock);
174 } 174 }
  175 + if (stop) {
  176 + break;
  177 + }
175 178
176 const auto &s = samples_queue.front(); 179 const auto &s = samples_queue.front();
177 if (!resampler.Get()) { 180 if (!resampler.Get()) {