OBIDMS: Opened DMS now have a counter associated so that DMS are not

actually opened several times by the same program, which triggers the
cleaning of unfinished views and columns (to discuss)
This commit is contained in:
Celine Mercier
2017-11-24 17:58:47 +01:00
parent ee5d647d0d
commit 9e3ac477eb
4 changed files with 167 additions and 54 deletions

View File

@ -54,7 +54,7 @@ typedef struct OBIDMS_column* OBIDMS_column_p; /**< Declarations to avoid circu
typedef struct Opened_columns_list {
int nb_opened_columns; /**< Number of opened columns.
*/
OBIDMS_column_p columns[MAX_NB_OPENED_COLUMNS]; /**< Array of pointers on the opened columns.
OBIDMS_column_p columns[MAX_NB_OPENED_COLUMNS+1]; /**< Array of pointers on the opened columns.
*/
} Opened_columns_list_t, *Opened_columns_list_p;
@ -70,7 +70,7 @@ typedef OBIDMS_avl_group_p Obi_indexer_p; /**< Declarations to avoid circular
typedef struct Opened_indexers_list {
int nb_opened_indexers; /**< Number of opened indexers.
*/
Obi_indexer_p indexers[MAX_NB_OPENED_INDEXERS]; /**< Array of pointers on the opened indexers.
Obi_indexer_p indexers[MAX_NB_OPENED_INDEXERS+1]; /**< Array of pointers on the opened indexers.
*/
} Opened_indexers_list_t, *Opened_indexers_list_p;
@ -87,7 +87,7 @@ typedef struct OBIDMS {
char directory_name[OBIDMS_MAX_NAME+1]; /**< The name of the directory
* containing the DMS.
*/
char directory_path[MAX_PATH_LEN]; /**< The absolute path of the directory
char directory_path[MAX_PATH_LEN+1]; /**< The absolute path of the directory
* containing the DMS.
*/
DIR* directory; /**< A directory entry usable to
@ -127,6 +127,7 @@ typedef struct OBIDMS {
* @brief Global Array of DMS pointers listing all the DMS opened by a program.
*/
extern OBIDMS_p global_opened_dms_list[MAX_NB_OPENED_DMS+1];
extern int global_opened_dms_counter_list[MAX_NB_OPENED_DMS+1];
/**
@ -223,6 +224,7 @@ OBIDMS_p obi_dms(const char* dms_path);
* @brief Closes an opened OBITools Data Management instance (OBIDMS).
*
* @param dms A pointer as returned by obi_create_dms() or obi_open_dms().
* @param force Whether the DMS should be closed even if it is opened more than once.
*
* @returns An integer value indicating the success of the operation. Even on
* error, the `OBIDMS` structure is freed.
@ -234,7 +236,7 @@ OBIDMS_p obi_dms(const char* dms_path);
* @since May 2015
* @author Eric Coissac (eric.coissac@metabarcoding.org)
*/
int obi_close_dms(OBIDMS_p dms);
int obi_close_dms(OBIDMS_p dms, bool force);
/**