#include ///< For boolean constants #include #define BUFF_SIZE 8 #define SET_MAX_SIZE 8 /// Struct for the edge typedef struct edge { int u, v; } edge_t; /// Struct for the feedback arc set typedef struct fb_arc_set { bool valid; int edge_num; edge_t edges[SET_MAX_SIZE]; } fb_arc_set_t; /// Struct for the circular buffer typedef struct buffer { bool finished; short best_arc_len; fb_arc_set_t sets[BUFF_SIZE]; } buffer_t; static bool terminate = false; static int buffer_shmfd; static buffer_t *circ_buffer; /** * @brief Function to execute when the program gets a signal * @details Flips the terminate variable to true * @param signo * @return none **/ static void signal_handler(int signo) { terminate = true; } /** * @brief Function to process the signals passed by the user * @details Creates a new sigaction structure * and changes the behaviour of the SIGINT and SIGTERM signals * @param none * @return none **/ static void process_signal(void){ struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = signal_handler; sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); }