From: Kevin Day Date: Tue, 9 Jul 2024 03:57:46 +0000 (-0500) Subject: Bugfix: Don't assign enabled variable on lock failure to avoid potential race conditi... X-Git-Tag: 0.6.11~27 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=49a3d41d1c17734b0a8299b356f1e299386f4a42;p=fll Bugfix: Don't assign enabled variable on lock failure to avoid potential race condition in the Controller program. --- diff --git a/level_3/controller/c/thread/private-thread_process.c b/level_3/controller/c/thread/private-thread_process.c index 2720596..e11dae0 100644 --- a/level_3/controller/c/thread/private-thread_process.c +++ b/level_3/controller/c/thread/private-thread_process.c @@ -374,21 +374,13 @@ extern "C" { f_thread_mutex_unlock(&global->thread->lock.alert); } - else { - global->thread->enabled = controller_thread_enabled_not_e; - } } else { struct timespec time; do { status = f_thread_mutex_lock(&global->thread->lock.alert); - - if (F_status_is_error(status)) { - global->thread->enabled = controller_thread_enabled_not_e; - - break; - } + if (F_status_is_error(status)) break; controller_time(controller_thread_exit_ready_timeout_seconds_d, controller_thread_exit_ready_timeout_nanoseconds_d, &time); @@ -404,9 +396,6 @@ extern "C" { f_thread_mutex_unlock(&global->thread->lock.alert); } - else { - global->thread->enabled = controller_thread_enabled_not_e; - } } } @@ -426,9 +415,6 @@ extern "C" { f_thread_mutex_unlock(&global->thread->lock.alert); } - else { - global->thread->enabled = controller_thread_enabled_not_e; - } } } #endif // _di_controller_thread_process_exit_