1
1

pmix/external: Fix error handler usage

Этот коммит содержится в:
Gilles Gouaillardet 2015-12-28 23:10:57 +09:00
родитель 1157329732
Коммит c757c5c612
2 изменённых файлов: 32 добавлений и 2 удалений

17
opal/mca/pmix/external/pmix_ext_client.c поставляемый
Просмотреть файл

@ -36,6 +36,18 @@ static pmix_proc_t my_proc;
static char *dbgvalue=NULL; static char *dbgvalue=NULL;
static int errhdler_ref = 0; static int errhdler_ref = 0;
static void completion_handler (void * cbdata) {
int * cond = (int *)cbdata;
*cond = 0;
}
#define PMIX_WAIT_FOR_COMPLETION(a) \
do { \
while ((a)) { \
usleep(10); \
} \
} while (0);
static void myerr(pmix_status_t status, static void myerr(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs, pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo) pmix_info_t info[], size_t ninfo)
@ -45,6 +57,7 @@ static void myerr(pmix_status_t status,
opal_namelist_t *nm; opal_namelist_t *nm;
opal_value_t *iptr; opal_value_t *iptr;
size_t n; size_t n;
volatile int cond = 1;
/* convert the incoming status */ /* convert the incoming status */
rc = pmix1_convert_rc(status); rc = pmix1_convert_rc(status);
@ -68,7 +81,9 @@ static void myerr(pmix_status_t status,
} }
/* call the base errhandler */ /* call the base errhandler */
opal_pmix_base_errhandler(rc, &plist, &ilist); opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&cond);
PMIX_WAIT_FOR_COMPLETION(cond);
OPAL_LIST_DESTRUCT(&plist); OPAL_LIST_DESTRUCT(&plist);
OPAL_LIST_DESTRUCT(&ilist); OPAL_LIST_DESTRUCT(&ilist);
} }

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

@ -50,6 +50,18 @@ extern opal_pmix_server_module_t *host_module;
static char *dbgvalue=NULL; static char *dbgvalue=NULL;
static int errhdler_ref = 0; static int errhdler_ref = 0;
static void completion_handler (void * cbdata) {
int * cond = (int *)cbdata;
*cond = 0;
}
#define PMIX_WAIT_FOR_COMPLETION(a) \
do { \
while ((a)) { \
usleep(10); \
} \
} while (0);
static void myerr(pmix_status_t status, static void myerr(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs, pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo) pmix_info_t info[], size_t ninfo)
@ -58,6 +70,7 @@ static void myerr(pmix_status_t status,
opal_list_t plist, ilist; opal_list_t plist, ilist;
opal_namelist_t *nm; opal_namelist_t *nm;
opal_value_t *iptr; opal_value_t *iptr;
volatile int cond = 1;
size_t n; size_t n;
/* convert the incoming status */ /* convert the incoming status */
@ -82,7 +95,9 @@ static void myerr(pmix_status_t status,
} }
/* call the base errhandler */ /* call the base errhandler */
opal_pmix_base_errhandler(rc, &plist, &ilist); opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&cond);
PMIX_WAIT_FOR_COMPLETION(cond);
OPAL_LIST_DESTRUCT(&plist); OPAL_LIST_DESTRUCT(&plist);
OPAL_LIST_DESTRUCT(&ilist); OPAL_LIST_DESTRUCT(&ilist);
} }