fixup! espeak: back off before retrying after any espeak error

This commit is contained in:
Alexander Epaneshnikov 2026-06-11 11:35:26 +03:00
commit ff0d74d4b1
No known key found for this signature in database
GPG key ID: 1736C918F59A5673
2 changed files with 4 additions and 3 deletions

View file

@ -375,7 +375,7 @@ static void espeak_wait_retry(void)
{
struct timespec timeout;
clock_gettime(CLOCK_REALTIME, &timeout);
clock_gettime(CLOCK_MONOTONIC, &timeout);
timeout.tv_sec++;
pthread_cond_timedwait(&wake_stop, &queue_guard, &timeout);
}

View file

@ -41,8 +41,8 @@ volatile int should_run = 1;
espeak_AUDIO_OUTPUT audio_mode;
pthread_cond_t runner_awake = PTHREAD_COND_INITIALIZER;
pthread_cond_t wake_stop = PTHREAD_COND_INITIALIZER;
/* Initialized in main: uses the monotonic clock for timed waits. */
/* Initialized in main: use the monotonic clock for timed waits. */
pthread_cond_t wake_stop;
pthread_cond_t stop_acknowledged;
pthread_mutex_t queue_guard = PTHREAD_MUTEX_INITIALIZER;
@ -157,6 +157,7 @@ int main(int argc, char **argv)
* too early or far too late. */
pthread_condattr_init(&monotonic_attr);
pthread_condattr_setclock(&monotonic_attr, CLOCK_MONOTONIC);
pthread_cond_init(&wake_stop, &monotonic_attr);
pthread_cond_init(&stop_acknowledged, &monotonic_attr);
pthread_condattr_destroy(&monotonic_attr);