Added signal catching and handling in C and Cython

This commit is contained in:
Celine Mercier
2019-09-21 16:47:22 +02:00
parent 06f9d6da60
commit ec0737a600
23 changed files with 178 additions and 25 deletions

31
src/obisig.c Executable file
View File

@ -0,0 +1,31 @@
/****************************************************************************
* Functions for signal catching and handling *
****************************************************************************/
/**
* @file obisig.c
* @author Celine Mercier (celine.mercier@metabarcoding.org)
* @date September 2019
* @brief Functions for signal catching and handling.
*/
#include "obidebug.h"
#include "obierrno.h"
#include "obisig.h"
#include <stdbool.h>
#include <signal.h>
#define DEBUG_LEVEL 0 // TODO has to be defined somewhere else (cython compil flag?)
bool volatile keep_running = true;
void sig_handler(int signum)
{
obi_set_errno(OBI_SIGNAL_CAUGHT);
obidebug(1, "\nCaught signal: %s\n", strsignal(signum));
keep_running = false;
}