Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions opal/mca/pmix/pmix2x/pmix2x_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2018 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -165,6 +168,8 @@ int pmix2x_client_finalize(void)
{
pmix_status_t rc;
opal_pmix2x_event_t *event, *ev2;
opal_list_t evlist;
OBJ_CONSTRUCT(&evlist, opal_list_t);

opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client finalize");
Expand All @@ -178,12 +183,19 @@ int pmix2x_client_finalize(void)
OPAL_PMIX_DESTRUCT_LOCK(&event->lock);
OPAL_PMIX_CONSTRUCT_LOCK(&event->lock);
PMIx_Deregister_event_handler(event->index, dereg_cbfunc, (void*)event);
OPAL_PMIX_WAIT_THREAD(&event->lock);
opal_list_remove_item(&mca_pmix_pmix2x_component.events, &event->super);
OBJ_RELEASE(event);
/* wait and release outside the loop to avoid double mutex
* interlock */
opal_list_append(&evlist, &event->super);
}
}
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
OPAL_LIST_FOREACH_SAFE(event, ev2, &evlist, opal_pmix2x_event_t) {
OPAL_PMIX_WAIT_THREAD(&event->lock);
opal_list_remove_item(&evlist, &event->super);
OBJ_RELEASE(event);
}
OBJ_DESTRUCT(&evlist);
rc = PMIx_Finalize(NULL, 0);

return pmix2x_convert_rc(rc);
Expand Down
17 changes: 14 additions & 3 deletions opal/mca/pmix/pmix2x/pmix2x_server_south.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2017 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2018 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -180,6 +183,8 @@ int pmix2x_server_finalize(void)
{
pmix_status_t rc;
opal_pmix2x_event_t *event, *ev2;
opal_list_t evlist;
OBJ_CONSTRUCT(&evlist, opal_list_t);

OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
--opal_pmix_base.initialized;
Expand All @@ -190,13 +195,19 @@ int pmix2x_server_finalize(void)
OPAL_PMIX_DESTRUCT_LOCK(&event->lock);
OPAL_PMIX_CONSTRUCT_LOCK(&event->lock);
PMIx_Deregister_event_handler(event->index, dereg_cbfunc, (void*)event);
OPAL_PMIX_WAIT_THREAD(&event->lock);
opal_list_remove_item(&mca_pmix_pmix2x_component.events, &event->super);
OBJ_RELEASE(event);
/* wait and release outside the loop to avoid double mutex
* interlock */
opal_list_append(&evlist, &event->super);
}
}
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);

OPAL_LIST_FOREACH_SAFE(event, ev2, &evlist, opal_pmix2x_event_t) {
OPAL_PMIX_WAIT_THREAD(&event->lock);
opal_list_remove_item(&evlist, &event->super);
OBJ_RELEASE(event);
}
OBJ_DESTRUCT(&evlist);
rc = PMIx_server_finalize();
return pmix2x_convert_rc(rc);
}
Expand Down