btl/scif: fix hang at shutdown
scif_close is not causing scif_poll in the listening thread to return as expected. To ensure the thread exits attempt to make a local connection to wake up the thread before calling pthread_join. cmr=v1.8.2:reviewer=ggouaillardet This commit was SVN r31756.
Этот коммит содержится в:
родитель
2abf647f59
Коммит
97605a4002
@ -90,6 +90,8 @@ typedef struct mca_btl_scif_module_t {
|
||||
ompi_free_list_t eager_frags;
|
||||
|
||||
pthread_t listen_thread;
|
||||
|
||||
bool exiting;
|
||||
} mca_btl_scif_module_t;
|
||||
|
||||
typedef struct mca_btl_scif_component_t {
|
||||
|
@ -117,7 +117,7 @@ static void *mca_btl_scif_connect_accept (void *arg)
|
||||
|
||||
rc = scif_poll (&pollepd, 1, -1);
|
||||
if (1 == rc) {
|
||||
if (SCIF_POLLIN != pollepd.revents) {
|
||||
if (SCIF_POLLIN != pollepd.revents || mca_btl_scif_module.exiting) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -261,6 +261,7 @@ static mca_btl_base_module_t **mca_btl_scif_component_init (int *num_btl_modules
|
||||
}
|
||||
|
||||
base_modules[0] = &mca_btl_scif_module.super;
|
||||
mca_btl_scif_module.exiting = false;
|
||||
|
||||
rc = mca_btl_scif_modex_send ();
|
||||
if (OMPI_SUCCESS != rc) {
|
||||
|
@ -111,6 +111,8 @@ mca_btl_scif_module_finalize (struct mca_btl_base_module_t *btl)
|
||||
OBJ_DESTRUCT(&mca_btl_scif_module.dma_frags);
|
||||
OBJ_DESTRUCT(&mca_btl_scif_module.eager_frags);
|
||||
|
||||
mca_btl_scif_module.exiting = true;
|
||||
|
||||
/* close all open connections and release endpoints */
|
||||
if (NULL != scif_module->endpoints) {
|
||||
for (i = 0 ; i < scif_module->endpoint_count ; ++i) {
|
||||
@ -125,6 +127,8 @@ mca_btl_scif_module_finalize (struct mca_btl_base_module_t *btl)
|
||||
|
||||
/* close the listening endpoint */
|
||||
if (-1 != mca_btl_scif_module.scif_fd) {
|
||||
/* wake up the scif thread */
|
||||
scif_connect (mca_btl_scif_module.scif_fd, &mca_btl_scif_module.port_id);
|
||||
scif_close (mca_btl_scif_module.scif_fd);
|
||||
pthread_join(mca_btl_scif_module.listen_thread, NULL);
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user