From: Alberto Leiva Popper Date: Mon, 29 Sep 2025 23:20:33 +0000 (-0600) Subject: Wake up validation threads when the task queue is cleared X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f7128e6a9fcef4e56bf7d396b9f2fbcc3445bad;p=thirdparty%2FFORT-validator.git Wake up validation threads when the task queue is cleared Leads the threads to end immediately, avoiding a lengthy timeout. --- diff --git a/src/object/tal.c b/src/object/tal.c index 4d601fef..0275758b 100644 --- a/src/object/tal.c +++ b/src/object/tal.c @@ -265,6 +265,7 @@ pick_up_work(void *arg) task = NULL; } else if (vv == VV_FAIL) { task_stop(); + task_wakeup(); } break; } diff --git a/src/task.c b/src/task.c index 81795fd6..b4028a15 100644 --- a/src/task.c +++ b/src/task.c @@ -90,6 +90,13 @@ task_start(void) enabled = true; } +static void +__wakeup(void) +{ + panic_on_fail(pthread_cond_broadcast(&awakener), + "pthread_cond_broadcast"); +} + /* Returns true if the module had already been stopped. */ bool task_stop(void) @@ -99,6 +106,7 @@ task_stop(void) mutex_lock(&lock); result = !enabled; cleanup(); + __wakeup(); mutex_unlock(&lock); return result; @@ -188,8 +196,7 @@ void task_wakeup(void) { mutex_lock(&lock); - panic_on_fail(pthread_cond_broadcast(&awakener), - "pthread_cond_broadcast"); + __wakeup(); mutex_unlock(&lock); } @@ -199,8 +206,7 @@ task_wakeup_dormants(void) { mutex_lock(&lock); STAILQ_CONCAT(&waiting, &dormant); - panic_on_fail(pthread_cond_broadcast(&awakener), - "pthread_cond_broadcast"); + __wakeup(); mutex_unlock(&lock); }