From d5fd5d69b84cdcde67357a5a934b343e46a32cb2 Mon Sep 17 00:00:00 2001 From: Chris Brannon Date: Thu, 25 Jun 2009 20:33:17 -0500 Subject: [PATCH] don't wait on a condition variable if should_run is false --- softsynth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/softsynth.c b/softsynth.c index 4472ff4..21f3cb8 100644 --- a/softsynth.c +++ b/softsynth.c @@ -172,7 +172,7 @@ static void request_espeak_stop(void) pthread_mutex_lock(&queue_guard); runner_must_stop = 1; pthread_cond_signal(&runner_awake); /* Wake runner, if necessary. */ - while(runner_must_stop == 1) + while(should_run && (runner_must_stop == 1)) pthread_cond_wait(&stop_acknowledged, &queue_guard); /* wait for acknowledgement. */ pthread_mutex_unlock(&queue_guard); }