]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Wake up validation threads when the task queue is cleared
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 29 Sep 2025 23:20:33 +0000 (17:20 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 29 Sep 2025 23:20:33 +0000 (17:20 -0600)
Leads the threads to end immediately, avoiding a lengthy timeout.

src/object/tal.c
src/task.c

index 4d601fefdf31d6b6f56e49200062917d5ba3281c..0275758b0b32c414faad25ee9f5eb5c1f77394e5 100644 (file)
@@ -265,6 +265,7 @@ pick_up_work(void *arg)
                                task = NULL;
                        } else if (vv == VV_FAIL) {
                                task_stop();
+                               task_wakeup();
                        }
                        break;
                }
index 81795fd6ac72fa85960fc723220f04dd6a22b43b..b4028a1528cf9bbf0cd5b6a7c1ee7efd5acfcf33 100644 (file)
@@ -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);
 }