From: Kevin Day Date: Fri, 23 Apr 2021 12:43:29 +0000 (-0500) Subject: Update: signal wait after each time the state becomes "idle". X-Git-Tag: 0.5.3~22 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=dfb78c531b902363430c790be9276c9bf929b447;p=fll Update: signal wait after each time the state becomes "idle". This should give processes waiting more opportunities to wake up. --- diff --git a/level_3/controller/c/private-rule.c b/level_3/controller/c/private-rule.c index 4f03c60..7f81f50 100644 --- a/level_3/controller/c/private-rule.c +++ b/level_3/controller/c/private-rule.c @@ -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) { diff --git a/level_3/controller/c/private-thread.c b/level_3/controller/c/private-thread.c index cd1f373..6ebf7f7 100644 --- a/level_3/controller/c/private-thread.c +++ b/level_3/controller/c/private-thread.c @@ -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 {