#include <stdbool.h> ///< For boolean constants
#include <signal.h>
#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;
/**
* @brief Function to execute when the program gets a signal
* @details flips the terminate variable to true
* @param none
* @return none
**/
static void signal_handler() {
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
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);
static buffer_t *circ_buffer;