Added signal catching and handling in C and Cython
This commit is contained in:
12
src/obidms.c
12
src/obidms.c
@ -32,6 +32,7 @@
|
||||
#include "utils.h"
|
||||
#include "obilittlebigman.h"
|
||||
#include "libjson/json_utils.h"
|
||||
#include "obisig.h"
|
||||
|
||||
|
||||
#define DEBUG_LEVEL 0 // TODO has to be defined somewhere else (cython compil flag?)
|
||||
@ -1627,6 +1628,8 @@ int obi_import_view(const char* dms_path_1, const char* dms_path_2, const char*
|
||||
OBIDMS_column_header_p header = NULL;
|
||||
OBIDMS_column_header_p header_2 = NULL;
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
dms_1 = obi_open_dms(dms_path_1, false);
|
||||
if (dms_1 == NULL)
|
||||
{
|
||||
@ -1676,6 +1679,9 @@ int obi_import_view(const char* dms_path_1, const char* dms_path_2, const char*
|
||||
// Import each column and update with the new version number
|
||||
for (i=0; i < (view_1->infos->column_count); i++)
|
||||
{
|
||||
if (! keep_running)
|
||||
return -1;
|
||||
|
||||
new_version = obi_import_column(dms_path_1, dms_path_2, ((((view_1->infos)->column_references)[i]).column_refs).column_name, ((((view_1->infos)->column_references)[i]).column_refs).version);
|
||||
if (new_version == -1)
|
||||
{
|
||||
@ -1708,6 +1714,9 @@ int obi_import_view(const char* dms_path_1, const char* dms_path_2, const char*
|
||||
// Go through columns again to update associated columns
|
||||
for (i=0; i < (view_1->infos->column_count); i++)
|
||||
{
|
||||
if (! keep_running)
|
||||
return -1;
|
||||
|
||||
header = obi_column_get_header_from_name(dms_1, ((((view_1->infos)->column_references)[i]).column_refs).column_name, ((((view_1->infos)->column_references)[i]).column_refs).version);
|
||||
if (header == NULL)
|
||||
{
|
||||
@ -1747,6 +1756,9 @@ int obi_import_view(const char* dms_path_1, const char* dms_path_2, const char*
|
||||
}
|
||||
}
|
||||
|
||||
if (! keep_running)
|
||||
return -1;
|
||||
|
||||
// Close the views
|
||||
if (obi_save_and_close_view(view_1) < 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user