本文整理汇总了C++中opal_list_get_end函数的典型用法代码示例。如果您正苦于以下问题:C++ opal_list_get_end函数的具体用法?C++ opal_list_get_end怎么用?C++ opal_list_get_end使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了opal_list_get_end函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: opal_hash_table_get_value_uint64
int opal_hash_table_get_value_uint64(opal_hash_table_t* ht, uint64_t key,
void **ptr)
{
opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
opal_uint64_hash_node_t *node;
#if OPAL_ENABLE_DEBUG
if(ht->ht_table_size == 0) {
opal_output(0, "opal_hash_table_get_value_uint64:"
"opal_hash_table_init() has not been called");
return OPAL_ERROR;
}
#endif
for(node = (opal_uint64_hash_node_t*)opal_list_get_first(list);
node != (opal_uint64_hash_node_t*)opal_list_get_end(list);
node = (opal_uint64_hash_node_t*)opal_list_get_next(node)) {
if (node->hn_key == key) {
*ptr = node->hn_value;
return OPAL_SUCCESS;
}
}
return OPAL_ERR_NOT_FOUND;
}
示例2: mca_btl_openib_proc_reg_btl
int mca_btl_openib_proc_reg_btl(mca_btl_openib_proc_t* ib_proc,
mca_btl_openib_module_t* openib_btl)
{
mca_btl_openib_proc_btlptr_t* elem;
for(elem = (mca_btl_openib_proc_btlptr_t*)opal_list_get_first(&ib_proc->openib_btls);
elem != (mca_btl_openib_proc_btlptr_t*)opal_list_get_end(&ib_proc->openib_btls);
elem = (mca_btl_openib_proc_btlptr_t*)opal_list_get_next(elem)) {
if(elem->openib_btl == openib_btl) {
/* this is normal return meaning that this BTL has already touched this ib_proc */
return OPAL_ERR_RESOURCE_BUSY;
}
}
elem = OBJ_NEW(mca_btl_openib_proc_btlptr_t);
if( NULL == elem ){
return OPAL_ERR_OUT_OF_RESOURCE;
}
elem->openib_btl = openib_btl;
opal_list_append(&ib_proc->openib_btls, &elem->super);
return OPAL_SUCCESS;
}
示例3: mca_btl_udapl_proc_lookup_ompi
/*
* Look for an existing uDAPL process instances based on the associated
* ompi_proc_t instance.
*/
static mca_btl_udapl_proc_t* mca_btl_udapl_proc_lookup_ompi(ompi_proc_t* ompi_proc)
{
mca_btl_udapl_proc_t* udapl_proc;
OPAL_THREAD_LOCK(&mca_btl_udapl_component.udapl_lock);
for(udapl_proc = (mca_btl_udapl_proc_t*)
opal_list_get_first(&mca_btl_udapl_component.udapl_procs);
udapl_proc != (mca_btl_udapl_proc_t*)
opal_list_get_end(&mca_btl_udapl_component.udapl_procs);
udapl_proc = (mca_btl_udapl_proc_t*)opal_list_get_next(udapl_proc)) {
if(udapl_proc->proc_ompi == ompi_proc) {
OPAL_THREAD_UNLOCK(&mca_btl_udapl_component.udapl_lock);
return udapl_proc;
}
}
OPAL_THREAD_UNLOCK(&mca_btl_udapl_component.udapl_lock);
return NULL;
}
示例4: mca_btl_template_proc_lookup_ompi
/*
* Look for an existing TEMPLATE process instances based on the associated
* ompi_proc_t instance.
*/
static mca_btl_template_proc_t* mca_btl_template_proc_lookup_ompi(ompi_proc_t* ompi_proc)
{
mca_btl_template_proc_t* template_proc;
OPAL_THREAD_LOCK(&mca_btl_template_component.template_lock);
for(template_proc = (mca_btl_template_proc_t*)
opal_list_get_first(&mca_btl_template_component.template_procs);
template_proc != (mca_btl_template_proc_t*)
opal_list_get_end(&mca_btl_template_component.template_procs);
template_proc = (mca_btl_template_proc_t*)opal_list_get_next(template_proc)) {
if(template_proc->proc_ompi == ompi_proc) {
OPAL_THREAD_UNLOCK(&mca_btl_template_component.template_lock);
return template_proc;
}
}
OPAL_THREAD_UNLOCK(&mca_btl_template_component.template_lock);
return NULL;
}
示例5: opal_graph_get_graph_vertices
/**
* This graph API returns an array of pointers of all the
* vertices in the graph.
*
*
* @param graph
* @param vertices_list an array of pointers of all the
* vertices in the graph vertices.
*
* @return int returning the graph order (the
* number of vertices in the returned array)
*/
int opal_graph_get_graph_vertices(opal_graph_t *graph, opal_pointer_array_t *vertices_list)
{
opal_adjacency_list_t *aj_list;
opal_list_item_t *item;
int i;
/**
* If the graph order is 0, return NULL.
*/
if (0 == graph->number_of_vertices) {
return 0;
}
/* Run on all the vertices of the graph */
for (item = opal_list_get_first(graph->adjacency_list), i = 0;
item != opal_list_get_end(graph->adjacency_list);
item = opal_list_get_next(item), i++) {
aj_list = (opal_adjacency_list_t *) item;
/* Add the vertex to the vertices array */
opal_pointer_array_add(vertices_list,(void *)aj_list->vertex);
}
/* return the vertices list */
return graph->number_of_vertices;
}
示例6: opal_list_get_end
/**
* This graph API finds a vertex in the graph according the
* vertex data.
* @param graph the graph we searching in.
* @param vertex_data the vertex data we are searching according
* to.
*
* @return opal_graph_vertex_t* The vertex founded or NULL.
*/
opal_graph_vertex_t *opal_graph_find_vertex(opal_graph_t *graph, void *vertex_data)
{
opal_adjacency_list_t *aj_list;
opal_list_item_t *item;
/**
* Run on all the vertices of the graph
*/
for (item = opal_list_get_first(graph->adjacency_list);
item != opal_list_get_end(graph->adjacency_list);
item = opal_list_get_next(item)) {
aj_list = (opal_adjacency_list_t *) item;
if (NULL != aj_list->vertex->compare_vertex) {
/* if the vertex data of a vertex is equal to the vertex data */
if (0 == aj_list->vertex->compare_vertex(aj_list->vertex->vertex_data, vertex_data)) {
/* return the found vertex */
return aj_list->vertex;
}
}
}
/* if a vertex is not found, return NULL */
return NULL;
}
示例7: orte_grpcomm_base_setup_collective
orte_grpcomm_collective_t* orte_grpcomm_base_setup_collective(orte_grpcomm_coll_id_t id)
{
opal_list_item_t *item;
orte_grpcomm_collective_t *cptr, *coll;
coll = NULL;
for (item = opal_list_get_first(&orte_grpcomm_base.active_colls);
item != opal_list_get_end(&orte_grpcomm_base.active_colls);
item = opal_list_get_next(item)) {
cptr = (orte_grpcomm_collective_t*)item;
if (id == cptr->id) {
coll = cptr;
break;
}
}
if (NULL == coll) {
coll = OBJ_NEW(orte_grpcomm_collective_t);
coll->id = id;
opal_list_append(&orte_grpcomm_base.active_colls, &coll->super);
}
return coll;
}
示例8: any_live_children
/*****************
* Local Functions
*****************/
static bool any_live_children(orte_jobid_t job)
{
opal_list_item_t *item;
orte_odls_child_t *child;
/* the thread is locked elsewhere - don't try to do it again here */
for (item = opal_list_get_first(&orte_local_children);
item != opal_list_get_end(&orte_local_children);
item = opal_list_get_next(item)) {
child = (orte_odls_child_t*)item;
/* is this child part of the specified job? */
if ((job == child->name->jobid || ORTE_JOBID_WILDCARD == job) &&
child->alive) {
return true;
}
}
/* if we get here, then nobody is left alive from that job */
return false;
}
示例9: ompi_proc_find_and_add
static ompi_proc_t *
ompi_proc_find_and_add(const ompi_process_name_t * name, bool* isnew)
{
ompi_proc_t *proc, *rproc = NULL;
ompi_rte_cmp_bitmask_t mask;
/* return the proc-struct which matches this jobid+process id */
mask = OMPI_RTE_CMP_JOBID | OMPI_RTE_CMP_VPID;
OPAL_THREAD_LOCK(&ompi_proc_lock);
for(proc = (ompi_proc_t*)opal_list_get_first(&ompi_proc_list);
proc != (ompi_proc_t*)opal_list_get_end(&ompi_proc_list);
proc = (ompi_proc_t*)opal_list_get_next(proc)) {
if (OPAL_EQUAL == ompi_rte_compare_name_fields(mask, &proc->proc_name, name)) {
rproc = proc;
*isnew = false;
break;
}
}
/* if we didn't find this proc in the list, create a new
* proc_t and append it to the list
*/
if (NULL == rproc) {
*isnew = true;
rproc = OBJ_NEW(ompi_proc_t);
if (NULL != rproc) {
opal_list_append(&ompi_proc_list, (opal_list_item_t*)rproc);
rproc->proc_name = *name;
}
/* caller had better fill in the rest of the proc, or there's
going to be pain later... */
}
OPAL_THREAD_UNLOCK(&ompi_proc_lock);
return rproc;
}
示例10: oshmem_proc_finalize
int oshmem_proc_finalize(void)
{
opal_list_item_t *item;
/* Destroy all groups */
oshmem_proc_group_finalize();
/* remove all items from list and destroy them. Since we cannot know
* the reference count of the procs for certain, it is possible that
* a single OBJ_RELEASE won't drive the count to zero, and hence will
* not release the memory. Accordingly, we cycle through the list here,
* calling release on each item.
*
* This will cycle until it forces the reference count of each item
* to zero, thus causing the destructor to run - which will remove
* the item from the list!
*
* We cannot do this under the thread lock as the destructor will
* call it when removing the item from the list. However, this function
* is ONLY called from MPI_Finalize, and all threads are prohibited from
* calling an MPI function once ANY thread has called MPI_Finalize. Of
* course, multiple threads are allowed to call MPI_Finalize, so this
* function may get called multiple times by various threads. We believe
* it is thread safe to do so...though it may not -appear- to be so
* without walking through the entire list/destructor sequence.
*/
while (opal_list_get_end(&oshmem_proc_list)
!= (item = opal_list_get_first(&oshmem_proc_list))) {
OBJ_RELEASE(item);
}
OBJ_RELEASE( oshmem_shmem_local_convertor);
/* now destruct the list and thread lock */
OBJ_DESTRUCT(&oshmem_proc_list);
OBJ_DESTRUCT(&oshmem_proc_lock);
return OSHMEM_SUCCESS;
}
示例11: opal_graph_add_edge
/**
* This graph API adds an edge (connection between two
* vertices) to a graph. The most common use
* for this API is while building a graph.
*
* @param graph The graph that this edge will be added to.
* @param edge The edge that we want to add.
*
* @return int Success or error. this API can return an error if
* one of the vertices is not in the graph.
*/
int opal_graph_add_edge(opal_graph_t *graph, opal_graph_edge_t *edge)
{
opal_adjacency_list_t *aj_list, *start_aj_list= NULL;
opal_list_item_t *item;
bool start_found = false, end_found = false;
/**
* find the vertices that this edge should connect.
*/
for (item = opal_list_get_first(graph->adjacency_list);
item != opal_list_get_end(graph->adjacency_list);
item = opal_list_get_next(item)) {
aj_list = (opal_adjacency_list_t *) item;
if (aj_list->vertex == edge->start) {
start_found = true;
start_aj_list = aj_list;
}
if (aj_list->vertex == edge->end) {
end_found = true;
}
}
/**
* if one of the vertices either the start or the end is not
* found - return an error.
*/
if (false == start_found && false == end_found) {
return OPAL_ERROR;
}
/* point the edge to the adjacency list of the start vertex (for easy search) */
edge->in_adj_list=start_aj_list;
/* append the edge to the adjacency list of the start vertex */
opal_list_append(start_aj_list->edges, (opal_list_item_t*)edge);
/* increase the graph size */
graph->number_of_edges++;
return OPAL_SUCCESS;
}
示例12: mca_oob_tcp_recv_cancel
int mca_oob_tcp_recv_cancel(
orte_process_name_t* name,
int tag)
{
int matched = 0;
opal_list_item_t *item, *next;
/* wait for any previously matched messages to be processed */
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_match_lock);
#if OMPI_ENABLE_PROGRESS_THREADS
if(opal_event_progress_thread() == false) {
while(mca_oob_tcp_component.tcp_match_count) {
opal_condition_wait(
&mca_oob_tcp_component.tcp_match_cond,
&mca_oob_tcp_component.tcp_match_lock);
}
}
#endif
/* remove any matching posted receives */
for(item = opal_list_get_first(&mca_oob_tcp_component.tcp_msg_post);
item != opal_list_get_end(&mca_oob_tcp_component.tcp_msg_post);
item = next) {
mca_oob_tcp_msg_t* msg = (mca_oob_tcp_msg_t*)item;
next = opal_list_get_next(item);
if (OPAL_EQUAL == opal_dss.compare(name, &msg->msg_peer, ORTE_NAME)) {
if (msg->msg_hdr.msg_tag == tag) {
opal_list_remove_item(&mca_oob_tcp_component.tcp_msg_post, &msg->super.super);
MCA_OOB_TCP_MSG_RETURN(msg);
matched++;
}
}
}
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_match_lock);
return (matched > 0) ? ORTE_SUCCESS : ORTE_ERR_NOT_FOUND;
}
示例13: orte_iof_base_endpoint_match
orte_iof_base_endpoint_t* orte_iof_base_endpoint_match(
const orte_process_name_t* target_name,
orte_ns_cmp_bitmask_t target_mask,
int target_tag)
{
opal_list_item_t* item;
OPAL_THREAD_LOCK(&orte_iof_base.iof_lock);
for(item = opal_list_get_first(&orte_iof_base.iof_endpoints);
item != opal_list_get_end(&orte_iof_base.iof_endpoints);
item = opal_list_get_next(item)) {
orte_iof_base_endpoint_t* endpoint = (orte_iof_base_endpoint_t*)item;
if(orte_ns.compare_fields(target_mask,target_name,&endpoint->ep_origin) == 0) {
if(endpoint->ep_tag == target_tag ||
endpoint->ep_tag == ORTE_IOF_ANY ||
target_tag == ORTE_IOF_ANY) {
OBJ_RETAIN(endpoint);
OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock);
return endpoint;
}
}
}
OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock);
return NULL;
}
示例14: mca_rcache_vma_clean
int mca_rcache_vma_clean(struct mca_rcache_base_module_t* rcache)
{
mca_rcache_vma_module_t *vma_rcache = (mca_rcache_vma_module_t*)rcache;
mca_rcache_vma_t *vma;
opal_list_item_t *i;
do {
OPAL_THREAD_LOCK(&rcache->lock);
i = opal_list_get_first(&vma_rcache->vma_delete_list);
if(opal_list_get_end(&vma_rcache->vma_delete_list) == i) {
vma = NULL;
OPAL_THREAD_UNLOCK(&rcache->lock);
} else {
vma = (mca_rcache_vma_t *)i;
opal_list_remove_item(&vma_rcache->vma_delete_list, &vma->super);
/* Need to drop the rcache lock before destroying the vma */
OPAL_THREAD_UNLOCK(&rcache->lock);
mca_rcache_vma_destroy(vma);
}
} while (NULL != vma);
return OMPI_SUCCESS;
}
示例15: opal_hash_table_remove_value_uint64
int opal_hash_table_remove_value_uint64(opal_hash_table_t* ht, uint64_t key)
{
opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
opal_uint64_hash_node_t *node;
#if OPAL_ENABLE_DEBUG
if(ht->ht_table_size == 0) {
opal_output(0, "opal_hash_table_remove_value_uint64:"
"opal_hash_table_init() has not been called");
return OPAL_ERR_BAD_PARAM;
}
#endif
for(node = (opal_uint64_hash_node_t*)opal_list_get_first(list);
node != (opal_uint64_hash_node_t*)opal_list_get_end(list);
node = (opal_uint64_hash_node_t*)opal_list_get_next(node)) {
if (node->hn_key == key) {
opal_list_remove_item(list, (opal_list_item_t*)node);
opal_list_append(&ht->ht_nodes, (opal_list_item_t*)node);
ht->ht_size--;
return OPAL_SUCCESS;
}
}
return OPAL_ERR_NOT_FOUND;
}