/********************************************************************** * DEALOCATE osm_vendor_t **********************************************************************/ void osm_vendor_destroy(IN osm_vendor_t * const p_vend) { OSM_LOG_ENTER(p_vend->p_log); osm_transaction_mgr_destroy(p_vend); /* Destroy the poller threads */ /* HACK: can you destroy an un-initialized thread ? */ pthread_cancel(p_vend->smi_bind.poller.osd.id); pthread_cancel(p_vend->gsi_bind.poller.osd.id); cl_thread_destroy(&(p_vend->smi_bind.poller)); cl_thread_destroy(&(p_vend->gsi_bind.poller)); OSM_LOG_EXIT(p_vend->p_log); }
void osm_vendor_unbind(IN osm_bind_handle_t h_bind) { mad_bind_info_t *p_mad_bind_info; umadt_obj_t *p_umadt_obj; cl_list_item_t *p_list_item, *p_next_list_item; CL_ASSERT(h_bind); p_mad_bind_info = (mad_bind_info_t *) h_bind; p_umadt_obj = p_mad_bind_info->p_umadt_obj; /* sanity check */ CL_ASSERT(p_umadt_obj); CL_ASSERT(p_umadt_obj->init_done); CL_ASSERT(__valid_mad_handle(p_mad_bind_info)); p_umadt_obj->uMadtInterface.uMadtDestroy(&p_mad_bind_info-> umadt_handle); cl_timer_destroy(&p_mad_bind_info->timeout_timer); cl_thread_destroy(&p_mad_bind_info->recv_processor_thread); cl_spinlock_acquire(&p_mad_bind_info->trans_ctxt_lock); p_list_item = cl_qlist_head(&p_mad_bind_info->trans_ctxt_list); while (p_list_item != cl_qlist_end(&p_mad_bind_info->trans_ctxt_list)) { p_next_list_item = cl_qlist_next(p_list_item); cl_qlist_remove_item(&p_mad_bind_info->trans_ctxt_list, p_list_item); free(p_list_item); p_list_item = p_next_list_item; } cl_spinlock_release(&p_mad_bind_info->trans_ctxt_lock); cl_spinlock_acquire(&p_mad_bind_info->timeout_list_lock); p_list_item = cl_qlist_head(&p_mad_bind_info->timeout_list); while (p_list_item != cl_qlist_end(&p_mad_bind_info->timeout_list)) { p_next_list_item = cl_qlist_next(p_list_item); cl_qlist_remove_item(&p_mad_bind_info->timeout_list, p_list_item); free(p_list_item); p_list_item = p_next_list_item; } cl_spinlock_release(&p_mad_bind_info->timeout_list_lock); free(p_mad_bind_info); }
void osmv_transport_done(IN const osm_bind_handle_t h_bind) { osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind; osmv_TOPSPIN_transport_mgr_t *p_tpot_mgr = (osmv_TOPSPIN_transport_mgr_t *) (p_bo->p_transp_mgr); CL_ASSERT(p_bo); /* First of all - zero out the magic_ptr, so if a callback is called - it'll know that we are currently closing down, and will not handle the mad. */ p_bo->magic_ptr = 0; /* usleep(3000000); */ /* seems the only way to abort a blocking read is to make it read something */ __osm_transport_gen_dummy_mad(p_bo); cl_thread_destroy(&(p_tpot_mgr->receiver)); free(p_tpot_mgr); }
void osm_vl15_destroy(IN osm_vl15_t * p_vl, IN struct osm_mad_pool *p_pool) { osm_madw_t *p_madw; OSM_LOG_ENTER(p_vl->p_log); /* Signal our threads that we're leaving. */ p_vl->thread_state = OSM_THREAD_STATE_EXIT; /* Don't trigger unless event has been initialized. Destroy the thread before we tear down the other objects. */ if (p_vl->state != OSM_VL15_STATE_INIT) cl_event_signal(&p_vl->signal); cl_thread_destroy(&p_vl->poller); /* Return the outstanding messages to the pool */ cl_spinlock_acquire(&p_vl->lock); while (!cl_is_qlist_empty(&p_vl->rfifo)) { p_madw = (osm_madw_t *) cl_qlist_remove_head(&p_vl->rfifo); osm_mad_pool_put(p_pool, p_madw); } while (!cl_is_qlist_empty(&p_vl->ufifo)) { p_madw = (osm_madw_t *) cl_qlist_remove_head(&p_vl->ufifo); osm_mad_pool_put(p_pool, p_madw); } cl_spinlock_release(&p_vl->lock); cl_event_destroy(&p_vl->signal); p_vl->state = OSM_VL15_STATE_INIT; cl_spinlock_destroy(&p_vl->lock); OSM_LOG_EXIT(p_vl->p_log); }