static void sig_exit(int signal) { kill_workers(); if(signal == SIGINT) print_stats(opt.output); destroy_options(&opt); if(signal == SIGINT) { sigaction(SIGINT, &sigdfl, NULL); kill(getpid(), SIGINT); } exit(signal); }
int main(int argc, char **argv) { int ret; if(sigaction(SIGINT, &sigact, NULL) < 0 || sigaction(SIGTERM, &sigact, NULL) < 0) { perror("Error installing signal handler"); return 1; } if(initialise_options(&opt, argc, argv) < 0) return 1; ret = get_loop(&opt); destroy_options(&opt); return ret; }
int main (int argc, char **argv) { int i; set_options (argc, argv); if (exercises_executor (argc, argv)) return; instance_t instance_type = input_type (argc, argv); algorithm_t alg_type = algorithm_type (argc, argv); /* if (!feof (stdin)) TODO Not working return; */ if (instance_type == taillard) for (i = 0; i < TAILLARD_N_INSTANCES; i++) fetch_execute (stdin, instance_type, alg_type); else fetch_execute (stdin, instance_type, alg_type); destroy_options (); }