From 0177e1d686edf411efa0e6ce169029a3d30c14a2 Mon Sep 17 00:00:00 2001 From: Christopher Brannon Date: Mon, 10 Oct 2016 18:04:16 -0700 Subject: [PATCH] Do not try to re-lock an already-locked mutex. --- src/libespeak-ng/fifo.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libespeak-ng/fifo.c b/src/libespeak-ng/fifo.c index 6b1fa926..12245377 100644 --- a/src/libespeak-ng/fifo.c +++ b/src/libespeak-ng/fifo.c @@ -203,18 +203,17 @@ static int sleep_until_start_request_or_inactivity() // for filtering underflow. // int i = 0; + int err = pthread_mutex_lock(&my_mutex); + assert(err != -1); while ((i <= MAX_INACTIVITY_CHECK) && !a_start_is_required) { i++; - int err = 0; struct timespec ts; struct timeval tv; clock_gettime2(&ts); add_time_in_ms(&ts, INACTIVITY_TIMEOUT); - err = pthread_mutex_lock(&my_mutex); - assert(err != -1); while ((err = pthread_cond_timedwait(&my_cond_start_is_required, &my_mutex, &ts)) == -1 && errno == EINTR)