From 45bf41d858ea565d94accf9d04d64bec98447757 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 4 Apr 2021 18:51:47 -0500 Subject: [PATCH] Update: controller program should immediately exit when doone after validating. When in validate mode, the controller progam should not sit and wait but instead should immediately exit. --- level_3/controller/c/private-thread.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/level_3/controller/c/private-thread.c b/level_3/controller/c/private-thread.c index b8b6c85..84cb2c1 100644 --- a/level_3/controller/c/private-thread.c +++ b/level_3/controller/c/private-thread.c @@ -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; -- 1.8.3.1