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 "sse_banded_LCS_alignment.h"
|
||||
@ -202,6 +203,8 @@ int obi_clean(const char* dms_name,
|
||||
|
||||
int max_threads = 1;
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
#ifdef _OPENMP
|
||||
max_threads = omp_get_max_threads();
|
||||
if ((thread_count == -1) || (thread_count > max_threads))
|
||||
@ -408,7 +411,7 @@ int obi_clean(const char* dms_name,
|
||||
|
||||
#pragma omp parallel default(none) \
|
||||
shared(thread_count, seq_count, blob_array, complete_sample_count_array, alignment_result_array, \
|
||||
stop, blob1, i, obi_errno, stderr, max_ratio, iseq_column, i_view, \
|
||||
stop, blob1, i, obi_errno, keep_running, stderr, max_ratio, iseq_column, i_view, \
|
||||
similarity_mode, reference, normalize, threshold, ktable, status_column, o_view, sample_count)
|
||||
{
|
||||
index_t j;
|
||||
@ -430,6 +433,9 @@ int obi_clean(const char* dms_name,
|
||||
#pragma omp for schedule(dynamic, sample_count/thread_count + (sample_count % thread_count != 0)) // Avoid 0 which blocks the program
|
||||
for (sample=0; sample < sample_count; sample++)
|
||||
{
|
||||
if (! keep_running)
|
||||
stop = true;
|
||||
|
||||
sample_count_array = complete_sample_count_array+(sample*seq_count);
|
||||
|
||||
// Get count for this sample
|
||||
|
Reference in New Issue
Block a user