From: Kevin Day Date: Fri, 24 Jan 2025 03:00:15 +0000 (-0600) Subject: Update: The threaded signal handler to avoid signal id races. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=b7996fecd7c9c840bf14d1e8858373cc51b768e4;p=kevux-tools Update: The threaded signal handler to avoid signal id races. Apply the same anti-race improvements implemented on the non-threaded signal checker to the threaded signal checker. Still check for a negative id to prevent the signal message from being printed more than once. --- diff --git a/sources/c/program/kevux/tools/remove/main/signal.c b/sources/c/program/kevux/tools/remove/main/signal.c index 1d1a708..aead2f6 100644 --- a/sources/c/program/kevux/tools/remove/main/signal.c +++ b/sources/c/program/kevux/tools/remove/main/signal.c @@ -23,8 +23,15 @@ extern "C" { #if !defined(_di_kt_remove_signal_check_) && !defined(_di_thread_support_) f_status_t kt_remove_signal_check(kt_remove_main_t * const main) { - if (!main || main->program.signal.id == -1) return F_false; - if (main->program.signal_received) return F_true; + if (!main) return F_false; + + if (main->program.signal_received) { + fll_program_print_signal_received(&main->program.warning, main->program.signal_received); + + main->setting.state.status = F_status_set_error(F_interrupt); + + return F_true; + } return F_false; } diff --git a/sources/c/program/kevux/tools/tacocat/main/signal.c b/sources/c/program/kevux/tools/tacocat/main/signal.c index b3db7fa..2d3c95b 100644 --- a/sources/c/program/kevux/tools/tacocat/main/signal.c +++ b/sources/c/program/kevux/tools/tacocat/main/signal.c @@ -23,8 +23,15 @@ extern "C" { #if !defined(_di_kt_tacocat_signal_check_) && !defined(_di_thread_support_) f_status_t kt_tacocat_signal_check(kt_tacocat_main_t * const main) { - if (!main || main->program.signal.id == -1) return F_false; - if (main->program.signal_received) return F_true; + if (!main) return F_false; + + if (main->program.signal_received) { + fll_program_print_signal_received(&main->program.warning, main->program.signal_received); + + main->setting.state.status = F_status_set_error(F_interrupt); + + return F_true; + } return F_false; }