Skip to content

Commit cb19296

Browse files
author
Ralph Castain
authored
Merge pull request #3794 from rhc54/topic/shutdown
Stop all progress threads prior to releasing the peer objects
2 parents 7e5e5fe + 85f8eb4 commit cb19296

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

orte/mca/oob/tcp/oob_tcp_component.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -698,24 +698,14 @@ static int component_startup(void)
698698
static void component_shutdown(void)
699699
{
700700
mca_oob_tcp_peer_t *peer;
701-
uint64_t ui64;
702-
int i = 0;
701+
int i = 0, rc;
702+
uint64_t key;
703+
void *node;
703704

704705
opal_output_verbose(2, orte_oob_base_framework.framework_output,
705706
"%s TCP SHUTDOWN",
706707
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
707708

708-
/* cleanup all peers */
709-
OPAL_HASH_TABLE_FOREACH(ui64, uint64, peer, &mca_oob_tcp_component.peers) {
710-
opal_output_verbose(2, orte_oob_base_framework.framework_output,
711-
"%s RELEASING PEER OBJ %s",
712-
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
713-
(NULL == peer) ? "NULL" : ORTE_NAME_PRINT(&peer->name));
714-
if (NULL != peer) {
715-
OBJ_RELEASE(peer);
716-
}
717-
}
718-
719709
if (0 < orte_oob_base.num_threads) {
720710
for (i=0; i < orte_oob_base.num_threads; i++) {
721711
opal_progress_thread_finalize(mca_oob_tcp_component.ev_threads[i]);
@@ -734,6 +724,18 @@ static void component_shutdown(void)
734724
"no hnp or not active");
735725
}
736726

727+
/* release all peers from the hash table */
728+
rc = opal_hash_table_get_first_key_uint64(&mca_oob_tcp_component.peers, &key,
729+
(void **)&peer, &node);
730+
while (OPAL_SUCCESS == rc) {
731+
if (NULL != peer) {
732+
OBJ_RELEASE(peer);
733+
opal_hash_table_set_value_uint64(&mca_oob_tcp_component.peers, key, NULL);
734+
}
735+
rc = opal_hash_table_get_next_key_uint64(&mca_oob_tcp_component.peers, &key,
736+
(void **) &peer, node, &node);
737+
}
738+
737739
opal_output_verbose(2, orte_oob_base_framework.framework_output,
738740
"%s TCP SHUTDOWN done",
739741
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));

0 commit comments

Comments
 (0)