From 25ba50d505b077c6bb4b1976b97eb5964f0d5d79 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 29 Jul 2025 21:42:38 -0500 Subject: [PATCH] Bugfix: Signal thread is not cancelling when f_thread_cancel() is used. Change the behavior to directly send the terminate signal using `f_thread_signal_write()`. This appears to get the signal handler thread to terminate when needed. The simulate validate mode now operates without hanging and without required a terminate signal. --- sources/c/program/controller/main/thread/instance.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sources/c/program/controller/main/thread/instance.c b/sources/c/program/controller/main/thread/instance.c index d0ec5b3..9886932 100644 --- a/sources/c/program/controller/main/thread/instance.c +++ b/sources/c/program/controller/main/thread/instance.c @@ -123,9 +123,9 @@ extern "C" { main->thread.id_control = 0; } - // The sigtimedwait() function that is run inside of signal must be interrupted via the f_thread_cancel(). + // The sigtimedwait() function that is run inside of signal must be interrupted directly via f_thread_signal_write(). if (by != controller_thread_cancel_signal_e && main->thread.id_signal) { - f_thread_cancel(main->thread.id_signal); + f_thread_signal_write(main->thread.id_signal, F_signal_termination); f_thread_join(main->thread.id_signal, 0); main->thread.id_signal = 0; @@ -371,9 +371,9 @@ extern "C" { if (F_status_is_error(status)) controller_thread_instance_force_set_disable(main); } - // The sigtimedwait() function that is run inside of signal must be interrupted via the f_thread_cancel(). + // The sigtimedwait() function that is run inside of signal must be interrupted directly via f_thread_signal_write(). if (main->thread.id_signal) { - f_thread_cancel(main->thread.id_signal); + f_thread_signal_write(main->thread.id_signal, F_signal_termination); f_thread_join(main->thread.id_signal, 0); main->thread.id_signal = 0; -- 1.8.3.1