diff options
Diffstat (limited to 'lib/common.c')
-rw-r--r-- | lib/common.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/common.c b/lib/common.c new file mode 100644 index 0000000..6a54108 --- /dev/null +++ b/lib/common.c @@ -0,0 +1,14 @@ +#include "./common.h" +#include <signal.h> + +void timer_handler(int signum) { + signum = signum; + + printf("Stopping due to timeout\n"); + exit(EXIT_FAILURE); +} + +void configure_timeout(int delay) { + signal(SIGALRM, timer_handler); + alarm(delay); +} |