From ff0d74d4b1aeed8b17e8f2e744afa38745c5966a Mon Sep 17 00:00:00 2001 From: Alexander Epaneshnikov Date: Thu, 11 Jun 2026 11:35:26 +0300 Subject: [PATCH] fixup! espeak: back off before retrying after any espeak error --- src/espeak.c | 2 +- src/espeakup.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/espeak.c b/src/espeak.c index c701f74..996d574 100644 --- a/src/espeak.c +++ b/src/espeak.c @@ -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); } diff --git a/src/espeakup.c b/src/espeakup.c index 1e39aaf..4e077f5 100644 --- a/src/espeakup.c +++ b/src/espeakup.c @@ -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);