Added signal catching and handling in C and Cython
This commit is contained in:
@ -24,6 +24,7 @@
|
||||
#include "obidms.h"
|
||||
#include "obidebug.h"
|
||||
#include "obierrno.h"
|
||||
#include "obisig.h"
|
||||
#include "obitypes.h"
|
||||
#include "obiview.h"
|
||||
#include "obi_lcs.h"
|
||||
@ -171,6 +172,8 @@ int build_reference_db(const char* dms_name,
|
||||
char threshold_str[5];
|
||||
char* new_comments;
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
// Discuss keeping the matrix view or not
|
||||
matrix_view_name = calloc((strlen(o_view_name)+strlen("_matrix")+1), sizeof(char));
|
||||
if (matrix_view_name == NULL)
|
||||
@ -321,6 +324,9 @@ int build_reference_db(const char* dms_name,
|
||||
// For each pair
|
||||
for (i=0; i<(matrix_with_lca_view->infos)->line_count; i++)
|
||||
{
|
||||
if (! keep_running)
|
||||
return -1;
|
||||
|
||||
// Read all taxids associated with the first sequence and compute their LCA
|
||||
// Read line index
|
||||
idx1 = obi_get_int_with_elt_idx_and_col_p_in_view(matrix_with_lca_view, matrix_idx1_column, i, 0);
|
||||
@ -440,6 +446,9 @@ int build_reference_db(const char* dms_name,
|
||||
// Going through matrix once, filling refs arrays on the go for efficiency
|
||||
for (i=0; i<(matrix_with_lca_view->infos)->line_count; i++)
|
||||
{
|
||||
if (! keep_running)
|
||||
return -1;
|
||||
|
||||
// Read ref line indexes
|
||||
idx1 = obi_get_int_with_elt_idx_and_col_p_in_view(matrix_with_lca_view, matrix_idx1_column, i, 0);
|
||||
idx2 = obi_get_int_with_elt_idx_and_col_p_in_view(matrix_with_lca_view, matrix_idx2_column, i, 0);
|
||||
|
Reference in New Issue
Block a user