Commit b05aa8de authored by Mathieu Giraud's avatar Mathieu Giraud

core/tools.{h,cpp}: sigintHandler()

see #4286
parent 79366fa4
...@@ -457,6 +457,20 @@ void json_add_warning(json &clone, string code, string msg, string level) ...@@ -457,6 +457,20 @@ void json_add_warning(json &clone, string code, string msg, string level)
clone["warn"] += { {"code", code}, {"level", level}, {"msg", msg} } ; clone["warn"] += { {"code", code}, {"level", level}, {"msg", msg} } ;
} }
// Signal handling
bool global_interrupted;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
void sigintHandler(int sig_num)
{
signal(SIGINT, sigintHandler);
global_interrupted = true;
}
#pragma GCC diagnostic pop
/* /*
Return the part of label before the star Return the part of label before the star
For example: For example:
......
...@@ -41,6 +41,7 @@ typedef string junction ; ...@@ -41,6 +41,7 @@ typedef string junction ;
#include <iomanip> #include <iomanip>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <signal.h>
#include <vector> #include <vector>
#include "bioreader.hpp" #include "bioreader.hpp"
#include "../lib/gzstream.h" #include "../lib/gzstream.h"
...@@ -96,6 +97,13 @@ inline int spaced_int(int *input, const string &seed) { ...@@ -96,6 +97,13 @@ inline int spaced_int(int *input, const string &seed) {
} }
/* Signal handling */
extern bool global_interrupted;
void sigintHandler(int sig_num);
/* /*
Extract the gene name from a label. This take the whole part Extract the gene name from a label. This take the whole part
before the star and returns it. If there is no star in the before the star and returns it. If there is no star in the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment