]> Kevux Git Server - fll/commitdiff
Update: signal wait after each time the state becomes "idle".
authorKevin Day <thekevinday@gmail.com>
Fri, 23 Apr 2021 12:43:29 +0000 (07:43 -0500)
committerKevin Day <thekevinday@gmail.com>
Fri, 23 Apr 2021 12:47:32 +0000 (07:47 -0500)
This should give processes waiting more opportunities to wake up.

level_3/controller/c/private-rule.c
level_3/controller/c/private-thread.c

index 4f03c60aaed48590a3a0578575725452dcc99bbb..7f81f5029a9e9e4b8bc36add3b9a46e1e6d3c9cb 100644 (file)
@@ -2471,6 +2471,10 @@ extern "C" {
       // the thread is done, so close the thread.
       if (process->state == controller_process_state_done) {
         controller_thread_join(&process->id_thread);
+
+        f_thread_mutex_lock(&process->wait_lock);
+        f_thread_condition_signal_all(&process->wait);
+        f_thread_mutex_unlock(&process->wait_lock);
       }
 
       process->id = at;
@@ -2592,6 +2596,10 @@ extern "C" {
         process->state = controller_process_state_idle;
       }
 
+      f_thread_mutex_lock(&process->wait_lock);
+      f_thread_condition_signal_all(&process->wait);
+      f_thread_mutex_unlock(&process->wait_lock);
+
       f_thread_unlock(&process->lock);
     }
 
@@ -5555,6 +5563,10 @@ extern "C" {
               process->state = controller_process_state_idle;
 
               f_thread_unlock(&process->active);
+
+              f_thread_mutex_lock(&process->wait_lock);
+              f_thread_condition_signal_all(&process->wait);
+              f_thread_mutex_unlock(&process->wait_lock);
             }
 
             if (caller) {
index cd1f373558f582fdca03f768742504c8f34d5584..6ebf7f7e42f1929be264a0a766964da802d1ba15 100644 (file)
@@ -86,6 +86,10 @@ extern "C" {
               process->state = controller_process_state_idle;
               process->id_thread = 0;
 
+              f_thread_mutex_lock(&process->wait_lock);
+              f_thread_condition_signal_all(&process->wait);
+              f_thread_mutex_unlock(&process->wait_lock);
+
               f_thread_unlock(&process->lock);
             }
             else {