]> Kevux Git Server - fll/commitdiff
Update: controller program should immediately exit when doone after validating.
authorKevin Day <thekevinday@gmail.com>
Sun, 4 Apr 2021 23:51:47 +0000 (18:51 -0500)
committerKevin Day <thekevinday@gmail.com>
Sun, 4 Apr 2021 23:51:47 +0000 (18:51 -0500)
When in validate mode, the controller progam should not sit and wait but instead should immediately exit.

level_3/controller/c/private-thread.c

index b8b6c85c20533a94885182574bee997953dd0c50..84cb2c10e7affbb5bf2cc8671e56ff8ea4046600 100644 (file)
@@ -338,20 +338,27 @@ extern "C" {
       controller_thread_process_cancel(&main);
     }
 
-    // wait until signal thread exits, which happens on any termination signal.
-    if (thread.id_signal) f_thread_join(thread.id_signal, 0);
+    if (data->parameters[controller_parameter_validate].result == f_console_result_none) {
+      if (thread.id_signal) {
+        f_thread_join(thread.id_signal, 0);
+
+        thread.id_signal = 0;
+      }
+    }
 
     controller_thread_process_cancel(&main);
 
+    if (thread.id_signal) f_thread_cancel(thread.id_signal);
     if (thread.id_cleanup) f_thread_cancel(thread.id_cleanup);
     if (thread.id_control) f_thread_cancel(thread.id_control);
     if (thread.id_rule) f_thread_cancel(thread.id_rule);
 
+    if (thread.id_signal) f_thread_join(thread.id_signal, 0);
     if (thread.id_cleanup) f_thread_join(thread.id_cleanup, 0);
     if (thread.id_control) f_thread_join(thread.id_control, 0);
     if (thread.id_rule) f_thread_join(thread.id_rule, 0);
 
-    // if made it here, then the threads no longer need to be killed.
+    // wait for exit thread to finish any cleanup.
     f_thread_join(thread.id_exit, 0);
 
     thread.id_cleanup = 0;