Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit ab22704

Browse files
author
Ralph Castain
committed
Ensure singletons register their progress thread
1 parent f0f6e87 commit ab22704

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

orte/mca/ess/singleton/ess_singleton_module.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "opal/mca/installdirs/installdirs.h"
4444
#include "opal/mca/pmix/base/base.h"
4545
#include "opal/mca/pmix/pmix.h"
46+
#include "opal/runtime/opal_progress_threads.h"
4647

4748
#include "orte/util/show_help.h"
4849
#include "orte/util/proc_info.h"
@@ -74,6 +75,7 @@ static bool added_num_procs = false;
7475
static bool added_app_ctx = false;
7576
static bool added_pmix_envs = false;
7677
static char *pmixenvars[4];
78+
static bool progress_thread_running = false;
7779

7880
static int fork_hnp(void);
7981

@@ -164,6 +166,11 @@ static int rte_init(void)
164166
/* our name was given to us by the HNP */
165167
}
166168

169+
/* get an async event base - we use the opal_async one so
170+
* we don't startup extra threads if not needed */
171+
orte_event_base = opal_progress_thread_init(NULL);
172+
progress_thread_running = true;
173+
167174
/* open and setup pmix */
168175
if (NULL == opal_pmix.initialized) {
169176
if (OPAL_SUCCESS != (ret = mca_base_framework_open(&opal_pmix_base_framework, 0))) {
@@ -365,15 +372,22 @@ static int rte_finalize(void)
365372
unsetenv("PMIX_SERVER_URI");
366373
unsetenv("PMIX_SECURITY_MODE");
367374
}
375+
376+
/* use the default procedure to finish */
377+
if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) {
378+
ORTE_ERROR_LOG(ret);
379+
}
380+
368381
/* mark us as finalized */
369382
if (NULL != opal_pmix.finalize) {
370383
opal_pmix.finalize();
371384
(void) mca_base_framework_close(&opal_pmix_base_framework);
372385
}
373386

374-
/* use the default procedure to finish */
375-
if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) {
376-
ORTE_ERROR_LOG(ret);
387+
/* release the event base */
388+
if (progress_thread_running) {
389+
opal_progress_thread_finalize(NULL);
390+
progress_thread_running = false;
377391
}
378392

379393
return ret;

0 commit comments

Comments
 (0)