Skip to content

Commit c757c5c

Browse files
committed
pmix/external: Fix error handler usage
1 parent 1157329 commit c757c5c

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

opal/mca/pmix/external/pmix_ext_client.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ static pmix_proc_t my_proc;
3636
static char *dbgvalue=NULL;
3737
static int errhdler_ref = 0;
3838

39+
static void completion_handler (void * cbdata) {
40+
int * cond = (int *)cbdata;
41+
*cond = 0;
42+
}
43+
44+
#define PMIX_WAIT_FOR_COMPLETION(a) \
45+
do { \
46+
while ((a)) { \
47+
usleep(10); \
48+
} \
49+
} while (0);
50+
3951
static void myerr(pmix_status_t status,
4052
pmix_proc_t procs[], size_t nprocs,
4153
pmix_info_t info[], size_t ninfo)
@@ -45,6 +57,7 @@ static void myerr(pmix_status_t status,
4557
opal_namelist_t *nm;
4658
opal_value_t *iptr;
4759
size_t n;
60+
volatile int cond = 1;
4861

4962
/* convert the incoming status */
5063
rc = pmix1_convert_rc(status);
@@ -68,7 +81,9 @@ static void myerr(pmix_status_t status,
6881
}
6982

7083
/* call the base errhandler */
71-
opal_pmix_base_errhandler(rc, &plist, &ilist);
84+
opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&cond);
85+
PMIX_WAIT_FOR_COMPLETION(cond);
86+
7287
OPAL_LIST_DESTRUCT(&plist);
7388
OPAL_LIST_DESTRUCT(&ilist);
7489
}

opal/mca/pmix/external/pmix_ext_server_south.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ extern opal_pmix_server_module_t *host_module;
5050
static char *dbgvalue=NULL;
5151
static int errhdler_ref = 0;
5252

53+
static void completion_handler (void * cbdata) {
54+
int * cond = (int *)cbdata;
55+
*cond = 0;
56+
}
57+
58+
#define PMIX_WAIT_FOR_COMPLETION(a) \
59+
do { \
60+
while ((a)) { \
61+
usleep(10); \
62+
} \
63+
} while (0);
64+
5365
static void myerr(pmix_status_t status,
5466
pmix_proc_t procs[], size_t nprocs,
5567
pmix_info_t info[], size_t ninfo)
@@ -58,6 +70,7 @@ static void myerr(pmix_status_t status,
5870
opal_list_t plist, ilist;
5971
opal_namelist_t *nm;
6072
opal_value_t *iptr;
73+
volatile int cond = 1;
6174
size_t n;
6275

6376
/* convert the incoming status */
@@ -82,7 +95,9 @@ static void myerr(pmix_status_t status,
8295
}
8396

8497
/* call the base errhandler */
85-
opal_pmix_base_errhandler(rc, &plist, &ilist);
98+
opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&cond);
99+
PMIX_WAIT_FOR_COMPLETION(cond);
100+
86101
OPAL_LIST_DESTRUCT(&plist);
87102
OPAL_LIST_DESTRUCT(&ilist);
88103
}

0 commit comments

Comments
 (0)