예제 #1
0
파일: oob_tcp.c 프로젝트: bureddy/ompi
/*
 * Module cleanup.
 */
static void tcp_fini(void)
{
    uint64_t ui64;
    char *nptr;
    mca_oob_tcp_peer_t *peer;

    /* cleanup all peers */
    if (OPAL_SUCCESS == opal_hash_table_get_first_key_uint64(&mca_oob_tcp_module.peers, &ui64,
                                                             (void**)&peer, (void**)&nptr)) {
        opal_output_verbose(2, orte_oob_base_framework.framework_output,
                            "%s RELEASING PEER OBJ %s",
                            ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
                            (NULL == peer) ? "NULL" : ORTE_NAME_PRINT(&peer->name));
        if (NULL != peer) {
            OBJ_RELEASE(peer);
        }
        while (OPAL_SUCCESS == opal_hash_table_get_next_key_uint64(&mca_oob_tcp_module.peers, &ui64,
                                                                   (void**)&peer, nptr, (void**)&nptr)) {
            opal_output_verbose(2, orte_oob_base_framework.framework_output,
                                "%s RELEASING PEER OBJ %s",
                                ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
                                (NULL == peer) ? "NULL" : ORTE_NAME_PRINT(&peer->name));
            if (NULL != peer) {
                OBJ_RELEASE(peer);
            }
        }
    }
    OBJ_DESTRUCT(&mca_oob_tcp_module.peers);

    if (mca_oob_tcp_module.ev_active) {
        /* if we used an independent progress thread at
         * the module level, stop it now
         */
        opal_output_verbose(2, orte_oob_base_framework.framework_output,
                            "%s STOPPING TCP PROGRESS THREAD",
                            ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
        /* stop the progress thread */
        mca_oob_tcp_module.ev_active = false;
        /* break the event loop */
        opal_event_base_loopexit(mca_oob_tcp_module.ev_base);
        /* wait for thread to exit */
        opal_thread_join(&mca_oob_tcp_module.progress_thread, NULL);
        OBJ_DESTRUCT(&mca_oob_tcp_module.progress_thread);
        /* release the event base */
        opal_event_base_free(mca_oob_tcp_module.ev_base);
    }
}
예제 #2
0
static void my_quit(int fd, short argc, void *cbdata)
{
    orte_event_base_active = false;
    opal_event_base_loopexit(orte_event_base);
}