mirror of
https://github.com/linux-speakup/espeakup.git
synced 2026-08-09 17:29:10 +02:00
wait for acknowledgements correctly
pthread_cond_wait() can have spurious wakeups, so we need to be sure that the condition is actually true when we return from this function. Thanks to Chris Brannon for the patch.
This commit is contained in:
parent
938e10b66a
commit
3687f16b09
1 changed files with 2 additions and 1 deletions
|
|
@ -170,7 +170,8 @@ static void request_espeak_stop(void)
|
|||
pthread_mutex_lock(&queue_guard);
|
||||
runner_must_stop = 1;
|
||||
pthread_cond_signal(&runner_awake); /* Wake runner, if necessary. */
|
||||
pthread_cond_wait(&stop_acknowledged, &queue_guard);
|
||||
while(runner_must_stop == 1)
|
||||
pthread_cond_wait(&stop_acknowledged, &queue_guard); /* wait for acknowledgement. */
|
||||
pthread_mutex_unlock(&queue_guard);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue