A compromise -- move the shutting down of the async thread to the
component_close, when we know all the btl modules are gone and there will be no more of them created. This commit was SVN r19214.
Этот коммит содержится в:
родитель
e835c89242
Коммит
4aff8038f9
ompi/mca/btl/openib
@ -997,29 +997,6 @@ int mca_btl_openib_finalize(struct mca_btl_base_module_t* btl)
|
|||||||
OBJ_RELEASE(openib_btl->device);
|
OBJ_RELEASE(openib_btl->device);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OMPI_HAVE_THREADS
|
|
||||||
if (mca_btl_openib_component.use_async_event_thread &&
|
|
||||||
0 == mca_btl_openib_component.ib_num_btls &&
|
|
||||||
mca_btl_openib_component.async_thread != 0) {
|
|
||||||
/* signaling to async_tread to stop */
|
|
||||||
int async_command=0;
|
|
||||||
if(write(mca_btl_openib_component.async_pipe[1], &async_command,
|
|
||||||
sizeof(int)) < 0) {
|
|
||||||
BTL_ERROR(("Failed to communicate with async event thread"));
|
|
||||||
rc = OMPI_ERROR;
|
|
||||||
} else {
|
|
||||||
if(pthread_join(mca_btl_openib_component.async_thread, NULL)) {
|
|
||||||
BTL_ERROR(("Failed to stop OpenIB async event thread"));
|
|
||||||
rc = OMPI_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(mca_btl_openib_component.async_pipe[0]);
|
|
||||||
close(mca_btl_openib_component.async_pipe[1]);
|
|
||||||
close(mca_btl_openib_component.async_comp_pipe[0]);
|
|
||||||
close(mca_btl_openib_component.async_comp_pipe[1]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
OBJ_DESTRUCT(&openib_btl->ib_lock);
|
OBJ_DESTRUCT(&openib_btl->ib_lock);
|
||||||
free(openib_btl);
|
free(openib_btl);
|
||||||
|
|
||||||
|
@ -156,13 +156,38 @@ int btl_openib_component_open(void)
|
|||||||
|
|
||||||
static int btl_openib_component_close(void)
|
static int btl_openib_component_close(void)
|
||||||
{
|
{
|
||||||
|
int rc = OMPI_SUCCESS;
|
||||||
|
|
||||||
|
#if OMPI_HAVE_THREADS
|
||||||
|
/* Tell the async thread to shutdown */
|
||||||
|
if (mca_btl_openib_component.use_async_event_thread &&
|
||||||
|
0 != mca_btl_openib_component.async_thread) {
|
||||||
|
int async_command = 0;
|
||||||
|
if (write(mca_btl_openib_component.async_pipe[1], &async_command,
|
||||||
|
sizeof(int)) < 0) {
|
||||||
|
BTL_ERROR(("Failed to communicate with async event thread"));
|
||||||
|
rc = OMPI_ERROR;
|
||||||
|
} else {
|
||||||
|
if (pthread_join(mca_btl_openib_component.async_thread, NULL)) {
|
||||||
|
BTL_ERROR(("Failed to stop OpenIB async event thread"));
|
||||||
|
rc = OMPI_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(mca_btl_openib_component.async_pipe[0]);
|
||||||
|
close(mca_btl_openib_component.async_pipe[1]);
|
||||||
|
close(mca_btl_openib_component.async_comp_pipe[0]);
|
||||||
|
close(mca_btl_openib_component.async_comp_pipe[1]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ompi_btl_openib_connect_base_finalize();
|
ompi_btl_openib_connect_base_finalize();
|
||||||
ompi_btl_openib_fd_finalize();
|
ompi_btl_openib_fd_finalize();
|
||||||
ompi_btl_openib_ini_finalize();
|
ompi_btl_openib_ini_finalize();
|
||||||
if (NULL != mca_btl_openib_component.receive_queues) {
|
if (NULL != mca_btl_openib_component.receive_queues) {
|
||||||
free(mca_btl_openib_component.receive_queues);
|
free(mca_btl_openib_component.receive_queues);
|
||||||
}
|
}
|
||||||
return OMPI_SUCCESS;
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool check_basics(void)
|
static bool check_basics(void)
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user