1
1

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.
Этот коммит содержится в:
Jeff Squyres 2008-08-07 13:48:38 +00:00
родитель e835c89242
Коммит 4aff8038f9
2 изменённых файлов: 26 добавлений и 24 удалений

Просмотреть файл

@ -997,29 +997,6 @@ int mca_btl_openib_finalize(struct mca_btl_base_module_t* btl)
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);
free(openib_btl);

Просмотреть файл

@ -156,13 +156,38 @@ int btl_openib_component_open(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_fd_finalize();
ompi_btl_openib_ini_finalize();
if (NULL != mca_btl_openib_component.receive_queues) {
free(mca_btl_openib_component.receive_queues);
}
return OMPI_SUCCESS;
return rc;
}
static bool check_basics(void)