Count how many times the opal library get initialized and require the same
numbers of finalizations before really destroying the internals. This commit was SVN r11303.
Этот коммит содержится в:
родитель
983eb15335
Коммит
136c79908b
@ -66,11 +66,17 @@ opal_finalize_util(void)
|
|||||||
return OPAL_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int opal_initialized;
|
||||||
|
|
||||||
int
|
int
|
||||||
opal_finalize(void)
|
opal_finalize(void)
|
||||||
{
|
{
|
||||||
|
if( --opal_initialized != 0 ) {
|
||||||
|
if( opal_initialized < 0 ) {
|
||||||
|
return OPAL_ERROR;
|
||||||
|
}
|
||||||
|
return OPAL_SUCCESS;
|
||||||
|
}
|
||||||
/* close high resolution timers */
|
/* close high resolution timers */
|
||||||
opal_timer_base_close();
|
opal_timer_base_close();
|
||||||
|
|
||||||
|
@ -36,6 +36,8 @@
|
|||||||
#include "opal/util/stacktrace.h"
|
#include "opal/util/stacktrace.h"
|
||||||
#include "opal/util/keyval_parse.h"
|
#include "opal/util/keyval_parse.h"
|
||||||
|
|
||||||
|
int opal_initialized = 0;
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
opal_err2str(int errnum)
|
opal_err2str(int errnum)
|
||||||
{
|
{
|
||||||
@ -122,6 +124,12 @@ opal_init_util(void)
|
|||||||
int ret;
|
int ret;
|
||||||
char *error = NULL;
|
char *error = NULL;
|
||||||
|
|
||||||
|
if( ++opal_initialized != 1 ) {
|
||||||
|
if( opal_initialized < 1 ) {
|
||||||
|
return OPAL_ERROR;
|
||||||
|
}
|
||||||
|
return OPAL_SUCCESS;
|
||||||
|
}
|
||||||
/* initialize the memory allocator */
|
/* initialize the memory allocator */
|
||||||
opal_malloc_init();
|
opal_malloc_init();
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user