* - flag: Flags passed to the main function.
* - action: The action type code.
* - size_write: The write size of a packet request or response.
- *
- * - status_signal: A status used eclusively by the threaded signal handler.
- * - state: The state data used when processing the data.
+ * - state: The state data used when processing the data.
*
* - range: A range for any particular use.
* - socket: A socket used to connect to the controller.
uint16_t flag;
uint8_t action;
f_number_unsigned_t size_write;
-
- f_status_t status_signal;
f_state_t state;
f_range_t range;
control_main_flag_none_d, \
0, \
0, \
- F_okay, \
f_state_t_initialize, \
f_range_t_initialize, \
f_socket_t_initialize, \
#if !defined(_di_control_signal_check_) && defined(_di_thread_support_)
f_status_t control_signal_check(control_main_t * const main) {
- if (!main || main->program.signal.id == -1) return F_false;
+ if (!main) return F_false;
+ if (main->program.signal_received) return F_true;
if (!((++main->program.signal_check) % control_signal_check_d)) {
- if (fll_program_standard_signal_received(&main->program)) {
+ if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interupt) {
fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
main->setting.state.status = F_status_set_error(F_interrupt);
if (!main) return;
- siginfo_t information;
- f_number_unsigned_t failsafe = 0;
-
- memset(&information, 0, sizeof(siginfo_t));
-
- main->program.signal_received = 0;
-
f_signal_set_empty(&main->program.signal.set);
f_signal_set_add(F_signal_abort, &main->program.signal.set);
f_signal_set_add(F_signal_broken_pipe, &main->program.signal.set);
f_signal_set_add(F_signal_quit, &main->program.signal.set);
f_signal_set_add(F_signal_termination, &main->program.signal.set);
- if (main->program.signal.id == -1) {
- main->setting.status_signal = f_signal_open(&main->program.signal);
-
- if (F_status_is_error(main->setting.status_signal)) {
- main->program.signal_received = F_signal_abort;
-
- return;
- }
- }
-
- do {
- memset(&information, 0, sizeof(siginfo_t));
-
- main->setting.status_signal = f_signal_wait(&main->program.signal.set, &information);
-
- if (F_status_is_error(main->setting.status_signal) && F_status_set_fine(main->setting.status_signal) != F_interrupt) {
- if (++failsafe >= control_signal_check_failsafe_d) break;
- }
-
- switch (information.si_signo) {
- case F_signal_abort:
- case F_signal_broken_pipe:
- case F_signal_hangup:
- case F_signal_interrupt:
- case F_signal_quit:
- case F_signal_termination:
- main->program.signal_received = information.si_signo;
-
- break;
- }
-
- failsafe = 0;
- main->setting.status_signal = F_okay;
-
- } while (!main->program.signal_received);
-
- f_signal_close(&main->program.signal);
+ fll_program_standard_signal_received_wait(&main->program, control_signal_check_failsafe_d);
- if (F_status_is_error(main->setting.status_signal)) {
+ if (F_status_is_error(main->program.signal_status) && F_status_set_fine(main->program.signal_status) != F_interrupt) {
main->program.signal_received = F_signal_abort;
}
}