]> Kevux Git Server - controller/commitdiff
Bugfix: Signal thread is not cancelling when f_thread_cancel() is used.
authorKevin Day <Kevin@kevux.org>
Wed, 30 Jul 2025 02:42:38 +0000 (21:42 -0500)
committerKevin Day <Kevin@kevux.org>
Wed, 30 Jul 2025 02:42:38 +0000 (21:42 -0500)
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

index d0ec5b391840699e2b07da9f5bc7c5392bb0089b..98869320cfd4992294ee39844a5e8225243eec7b 100644 (file)
@@ -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;