1
1

Replace a useless counter with a boolean check to see if we have already passed thru opal_finalize so we don't call finalize, and then don't pass thru it (as was happening on several tools)

This commit was SVN r24862.
Этот коммит содержится в:
Ralph Castain 2011-07-08 06:43:19 +00:00
родитель 05f4926bfe
Коммит aa92e0c4eb
3 изменённых файлов: 12 добавлений и 24 удалений

Просмотреть файл

@ -54,18 +54,16 @@
#include "opal/runtime/opal_cr.h" #include "opal/runtime/opal_cr.h"
#include "opal/mca/crs/base/base.h" #include "opal/mca/crs/base/base.h"
extern int opal_initialized; extern bool opal_initialized;
extern int opal_util_initialized; extern bool opal_util_initialized;
int int
opal_finalize_util(void) opal_finalize_util(void)
{ {
if( --opal_util_initialized != 0 ) { if (!opal_util_initialized) {
if( opal_util_initialized < 0 ) {
return OPAL_ERROR;
}
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
opal_util_initialized = false;
/* Clear out all the registered MCA params */ /* Clear out all the registered MCA params */
mca_base_param_finalize(); mca_base_param_finalize();
@ -111,12 +109,10 @@ opal_finalize_util(void)
int int
opal_finalize(void) opal_finalize(void)
{ {
if( --opal_initialized != 0 ) { if (!opal_initialized) {
if( opal_initialized < 0 ) {
return OPAL_ERROR;
}
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
opal_initialized = false;
/* close the checkpoint and restart service */ /* close the checkpoint and restart service */
opal_cr_finalize(); opal_cr_finalize();

Просмотреть файл

@ -68,8 +68,8 @@
#endif #endif
const char opal_version_string[] = OPAL_IDENT_STRING; const char opal_version_string[] = OPAL_IDENT_STRING;
int opal_initialized = 0; bool opal_initialized = false;
int opal_util_initialized = 0; bool opal_util_initialized = false;
int opal_cache_line_size; int opal_cache_line_size;
static int static int
@ -219,12 +219,10 @@ opal_init_util(int* pargc, char*** pargv)
int ret; int ret;
char *error = NULL; char *error = NULL;
if( ++opal_util_initialized != 1 ) { if (opal_util_initialized) {
if( opal_util_initialized < 1 ) {
return OPAL_ERROR;
}
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
opal_util_initialized = true;
/* JMS See note in runtime/opal.h -- this is temporary; to be /* JMS See note in runtime/opal.h -- this is temporary; to be
replaced with real hwloc information soon (in trunk/v1.5 and replaced with real hwloc information soon (in trunk/v1.5 and
@ -324,12 +322,10 @@ opal_init(int* pargc, char*** pargv)
int ret; int ret;
char *error = NULL; char *error = NULL;
if( ++opal_initialized != 1 ) { if (opal_initialized) {
if( opal_initialized < 1 ) {
return OPAL_ERROR;
}
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
opal_initialized = true;
/* initialize util code */ /* initialize util code */
if (OPAL_SUCCESS != (ret = opal_init_util(pargc, pargv))) { if (OPAL_SUCCESS != (ret = opal_init_util(pargc, pargv))) {

Просмотреть файл

@ -618,10 +618,6 @@ int orterun(int argc, char *argv[])
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }
/* finalize the OPAL utils. As they are opened again from orte_init->opal_init
* we continue to have a reference count on them. So we have to finalize them twice...
*/
opal_finalize_util();
/* check for request to report uri */ /* check for request to report uri */
if (NULL != orterun_globals.report_uri) { if (NULL != orterun_globals.report_uri) {