Merge pull request #2982 from rhc54/topic/threadstop
Cleanup PMIx shutdown
Этот коммит содержится в:
Коммит
578d8819cf
@ -459,8 +459,11 @@ PMIX_EXPORT pmix_status_t PMIx_Finalize(const pmix_info_t info[], size_t ninfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!pmix_globals.external_evbase) {
|
if (!pmix_globals.external_evbase) {
|
||||||
/* stop the progress thread */
|
/* stop the progress thread, but leave the event base
|
||||||
(void)pmix_progress_thread_stop(NULL);
|
* still constructed. This will allow us to safely
|
||||||
|
* tear down the infrastructure, including removal
|
||||||
|
* of any events objects may be holding */
|
||||||
|
(void)pmix_progress_thread_pause(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
PMIX_DESTRUCT(&pmix_client_globals.myserver);
|
PMIX_DESTRUCT(&pmix_client_globals.myserver);
|
||||||
@ -472,17 +475,13 @@ PMIX_EXPORT pmix_status_t PMIx_Finalize(const pmix_info_t info[], size_t ninfo)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pmix_rte_finalize();
|
|
||||||
|
|
||||||
PMIX_LIST_DESTRUCT(&pmix_client_globals.pending_requests);
|
PMIX_LIST_DESTRUCT(&pmix_client_globals.pending_requests);
|
||||||
|
|
||||||
if (0 <= pmix_client_globals.myserver.sd) {
|
if (0 <= pmix_client_globals.myserver.sd) {
|
||||||
CLOSE_THE_SOCKET(pmix_client_globals.myserver.sd);
|
CLOSE_THE_SOCKET(pmix_client_globals.myserver.sd);
|
||||||
}
|
}
|
||||||
|
|
||||||
pmix_bfrop_close();
|
pmix_rte_finalize();
|
||||||
|
|
||||||
pmix_class_finalize();
|
|
||||||
|
|
||||||
return PMIX_SUCCESS;
|
return PMIX_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -101,10 +101,8 @@ void pmix_rte_finalize(void)
|
|||||||
much */
|
much */
|
||||||
pmix_output_finalize();
|
pmix_output_finalize();
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* close the bfrops */
|
/* close the bfrops */
|
||||||
(void)pmix_mca_base_framework_close(&pmix_bfrops_base_framework);
|
pmix_bfrop_close();
|
||||||
#endif
|
|
||||||
|
|
||||||
/* clean out the globals */
|
/* clean out the globals */
|
||||||
PMIX_RELEASE(pmix_globals.mypeer);
|
PMIX_RELEASE(pmix_globals.mypeer);
|
||||||
@ -117,7 +115,14 @@ void pmix_rte_finalize(void)
|
|||||||
}
|
}
|
||||||
PMIX_DESTRUCT(&pmix_globals.events);
|
PMIX_DESTRUCT(&pmix_globals.events);
|
||||||
|
|
||||||
#if PMIX_NO_LIB_DESTRUCTOR
|
/* now safe to release the event base */
|
||||||
pmix_cleanup();
|
if (!pmix_globals.external_evbase) {
|
||||||
#endif
|
(void)pmix_progress_thread_stop(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if PMIX_NO_LIB_DESTRUCTOR
|
||||||
|
pmix_cleanup();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -227,11 +227,30 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
|
|||||||
return PMIX_SUCCESS;
|
return PMIX_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cleanup_server_state(void)
|
PMIX_EXPORT pmix_status_t PMIx_server_finalize(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
pmix_peer_t *peer;
|
pmix_peer_t *peer;
|
||||||
|
|
||||||
|
if (1 != pmix_globals.init_cntr) {
|
||||||
|
--pmix_globals.init_cntr;
|
||||||
|
return PMIX_SUCCESS;
|
||||||
|
}
|
||||||
|
pmix_globals.init_cntr = 0;
|
||||||
|
|
||||||
|
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||||
|
"pmix:server finalize called");
|
||||||
|
|
||||||
|
if (!pmix_globals.external_evbase) {
|
||||||
|
/* stop the progress thread, but leave the event base
|
||||||
|
* still constructed. This will allow us to safely
|
||||||
|
* tear down the infrastructure, including removal
|
||||||
|
* of any events objects may be holding */
|
||||||
|
(void)pmix_progress_thread_pause(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
pmix_ptl_base_stop_listening();
|
||||||
|
|
||||||
for (i=0; i < pmix_server_globals.clients.size; i++) {
|
for (i=0; i < pmix_server_globals.clients.size; i++) {
|
||||||
if (NULL != (peer = (pmix_peer_t*)pmix_pointer_array_get_item(&pmix_server_globals.clients, i))) {
|
if (NULL != (peer = (pmix_peer_t*)pmix_pointer_array_get_item(&pmix_server_globals.clients, i))) {
|
||||||
PMIX_RELEASE(peer);
|
PMIX_RELEASE(peer);
|
||||||
@ -255,33 +274,10 @@ static void cleanup_server_state(void)
|
|||||||
|
|
||||||
pmix_bfrop_close();
|
pmix_bfrop_close();
|
||||||
pmix_rte_finalize();
|
pmix_rte_finalize();
|
||||||
}
|
|
||||||
|
|
||||||
PMIX_EXPORT pmix_status_t PMIx_server_finalize(void)
|
|
||||||
{
|
|
||||||
if (1 != pmix_globals.init_cntr) {
|
|
||||||
--pmix_globals.init_cntr;
|
|
||||||
return PMIX_SUCCESS;
|
|
||||||
}
|
|
||||||
pmix_globals.init_cntr = 0;
|
|
||||||
|
|
||||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
|
||||||
"pmix:server finalize called");
|
|
||||||
|
|
||||||
if (!pmix_globals.external_evbase) {
|
|
||||||
/* stop the progress thread */
|
|
||||||
(void)pmix_progress_thread_stop(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
pmix_ptl_base_stop_listening();
|
|
||||||
|
|
||||||
cleanup_server_state();
|
|
||||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||||
"pmix:server finalize complete");
|
"pmix:server finalize complete");
|
||||||
|
|
||||||
/* finalize the class/object system */
|
|
||||||
pmix_class_finalize();
|
|
||||||
|
|
||||||
return PMIX_SUCCESS;
|
return PMIX_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,17 +518,18 @@ PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void)
|
|||||||
"pmix:tool finalize sync received");
|
"pmix:tool finalize sync received");
|
||||||
|
|
||||||
if (!pmix_globals.external_evbase) {
|
if (!pmix_globals.external_evbase) {
|
||||||
/* stop the progress thread */
|
/* stop the progress thread, but leave the event base
|
||||||
(void)pmix_progress_thread_stop(NULL);
|
* still constructed. This will allow us to safely
|
||||||
|
* tear down the infrastructure, including removal
|
||||||
|
* of any events objects may be holding */
|
||||||
|
(void)pmix_progress_thread_pause(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* shutdown services */
|
|
||||||
pmix_rte_finalize();
|
|
||||||
|
|
||||||
PMIX_DESTRUCT(&pmix_client_globals.myserver);
|
PMIX_DESTRUCT(&pmix_client_globals.myserver);
|
||||||
PMIX_LIST_DESTRUCT(&pmix_client_globals.pending_requests);
|
PMIX_LIST_DESTRUCT(&pmix_client_globals.pending_requests);
|
||||||
|
|
||||||
pmix_class_finalize();
|
/* shutdown services */
|
||||||
|
pmix_rte_finalize();
|
||||||
|
|
||||||
return PMIX_SUCCESS;
|
return PMIX_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user