本文整理汇总了C++中opal_list_remove_first函数的典型用法代码示例。如果您正苦于以下问题:C++ opal_list_remove_first函数的具体用法?C++ opal_list_remove_first怎么用?C++ opal_list_remove_first使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了opal_list_remove_first函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mca_btl_tcp2_endpoint_send_handler
static void mca_btl_tcp2_endpoint_send_handler(int sd, short flags, void* user)
{
mca_btl_tcp2_endpoint_t* btl_endpoint = (mca_btl_tcp2_endpoint_t *)user;
OPAL_THREAD_LOCK(&btl_endpoint->endpoint_send_lock);
switch(btl_endpoint->endpoint_state) {
case MCA_BTL_TCP_CONNECTING:
mca_btl_tcp2_endpoint_complete_connect(btl_endpoint);
break;
case MCA_BTL_TCP_CONNECTED:
/* complete the current send */
while (NULL != btl_endpoint->endpoint_send_frag) {
mca_btl_tcp2_frag_t* frag = btl_endpoint->endpoint_send_frag;
int btl_ownership = (frag->base.des_flags & MCA_BTL_DES_FLAGS_BTL_OWNERSHIP);
if(mca_btl_tcp2_frag_send(frag, btl_endpoint->endpoint_sd) == false) {
break;
}
/* progress any pending sends */
btl_endpoint->endpoint_send_frag = (mca_btl_tcp2_frag_t*)
opal_list_remove_first(&btl_endpoint->endpoint_frags);
/* if required - update request status and release fragment */
OPAL_THREAD_UNLOCK(&btl_endpoint->endpoint_send_lock);
assert( frag->base.des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK );
frag->base.des_cbfunc(&frag->btl->super, frag->endpoint, &frag->base, frag->rc);
if( btl_ownership ) {
MCA_BTL_TCP_FRAG_RETURN(frag);
}
OPAL_THREAD_LOCK(&btl_endpoint->endpoint_send_lock);
}
/* if nothing else to do unregister for send event notifications */
if(NULL == btl_endpoint->endpoint_send_frag) {
opal_event_del(&btl_endpoint->endpoint_send_event);
}
break;
default:
BTL_ERROR(("invalid connection state (%d)", btl_endpoint->endpoint_state));
opal_event_del(&btl_endpoint->endpoint_send_event);
break;
}
OPAL_THREAD_UNLOCK(&btl_endpoint->endpoint_send_lock);
}
示例2: mca_mpool_grdma_evict_lru_local
static inline bool mca_mpool_grdma_evict_lru_local (mca_mpool_grdma_pool_t *pool)
{
mca_mpool_grdma_module_t *mpool_grdma;
mca_mpool_base_registration_t *old_reg;
old_reg = (mca_mpool_base_registration_t *)
opal_list_remove_first (&pool->lru_list);
if (NULL == old_reg) {
return false;
}
mpool_grdma = (mca_mpool_grdma_module_t *) old_reg->mpool;
(void) dereg_mem (old_reg);
mpool_grdma->stat_evicted++;
return true;
}
示例3: mca_mpool_base_close
static int mca_mpool_base_close(void)
{
opal_list_item_t *item;
mca_mpool_base_selected_module_t *sm;
int32_t modules_length;
/* Need the initial length in order to know if some of the initializations
* are done in the open function.
*/
modules_length = opal_list_get_size(&mca_mpool_base_modules);
/* Finalize all the mpool components and free their list items */
while(NULL != (item = opal_list_remove_first(&mca_mpool_base_modules))) {
sm = (mca_mpool_base_selected_module_t *) item;
/* Blatently ignore the return code (what would we do to recover,
anyway? This component is going away, so errors don't matter
anymore). Note that it's legal for the module to have NULL for
the finalize function. */
if (NULL != sm->mpool_module->mpool_finalize) {
sm->mpool_module->mpool_finalize(sm->mpool_module);
}
OBJ_RELEASE(sm);
}
/* Close all remaining available components (may be one if this is a
OMPI RTE program, or [possibly] multiple if this is ompi_info) */
(void) mca_base_framework_components_close(&ompi_mpool_base_framework, NULL);
/* deregister memory free callback */
if( (modules_length > 0) && mca_mpool_base_used_mem_hooks &&
0 != (OPAL_MEMORY_FREE_SUPPORT & opal_mem_hooks_support_level())) {
opal_mem_hooks_unregister_release(mca_mpool_base_mem_cb);
}
mca_mpool_base_tree_fini();
/* All done */
return OMPI_SUCCESS;
}
示例4: mca_oob_tcp_peer_shutdown
void mca_oob_tcp_peer_shutdown(mca_oob_tcp_peer_t* peer)
{
/* giving up and cleanup any pending messages */
if(peer->peer_retries++ > mca_oob_tcp_component.tcp_peer_retries) {
mca_oob_tcp_msg_t *msg;
opal_output(0, "[%lu,%lu,%lu]-[%lu,%lu,%lu] mca_oob_tcp_peer_shutdown: retries exceeded",
ORTE_NAME_ARGS(orte_process_info.my_name),
ORTE_NAME_ARGS(&(peer->peer_name)));
/* There are cases during the initial connection setup where
the peer_send_msg is NULL but there are things in the queue
-- handle that case */
if (NULL != (msg = peer->peer_send_msg)) {
msg->msg_complete = true;
msg->msg_rc = ORTE_ERR_UNREACH;
mca_oob_tcp_msg_complete(msg, &peer->peer_name);
}
peer->peer_send_msg = NULL;
while (NULL !=
(msg = (mca_oob_tcp_msg_t*)opal_list_remove_first(&peer->peer_send_queue))) {
msg->msg_complete = true;
msg->msg_rc = ORTE_ERR_UNREACH;
mca_oob_tcp_msg_complete(msg, &peer->peer_name);
}
/* We were unsuccessful in establishing a connection, and are
not likely to suddenly become successful, so abort the
whole thing */
peer->peer_state = MCA_OOB_TCP_FAILED;
}
if (peer->peer_sd >= 0) {
opal_event_del(&peer->peer_recv_event);
opal_event_del(&peer->peer_send_event);
CLOSE_THE_SOCKET(peer->peer_sd);
peer->peer_sd = -1;
}
opal_event_del(&peer->peer_timer_event);
peer->peer_state = MCA_OOB_TCP_CLOSED;
}
示例5: remove_data
static int remove_data(const opal_identifier_t *uid, const char *key)
{
proc_data_t *proc_data;
opal_value_t *kv;
opal_identifier_t id;
/* to protect alignment, copy the data across */
memcpy(&id, uid, sizeof(opal_identifier_t));
/* lookup the specified proc */
if (NULL == (proc_data = lookup_opal_proc(&hash_data, id))) {
/* no data for this proc */
return OPAL_SUCCESS;
}
/* if key is NULL, remove all data for this proc */
if (NULL == key) {
while (NULL != (kv = (opal_value_t *) opal_list_remove_first(&proc_data->data))) {
OBJ_RELEASE(kv);
}
/* remove the proc_data object itself from the jtable */
opal_hash_table_remove_value_uint64(&hash_data, id);
/* cleanup */
OBJ_RELEASE(proc_data);
return OPAL_SUCCESS;
}
/* remove this item */
for (kv = (opal_value_t*) opal_list_get_first(&proc_data->data);
kv != (opal_value_t*) opal_list_get_end(&proc_data->data);
kv = (opal_value_t*) opal_list_get_next(kv)) {
if (0 == strcmp(key, kv->key)) {
opal_list_remove_item(&proc_data->data, &kv->super);
if (!(kv->scope & OPAL_SCOPE_REFER)) {
OBJ_RELEASE(kv);
}
break;
}
}
return OPAL_SUCCESS;
}
示例6: mca_btl_tcp2_endpoint_connected
static void mca_btl_tcp2_endpoint_connected(mca_btl_base_endpoint_t* btl_endpoint)
{
/* setup socket options */
btl_endpoint->endpoint_state = MCA_BTL_TCP_CONNECTED;
btl_endpoint->endpoint_retries = 0;
/* Create the send event in a persistent manner. */
opal_event_set(opal_event_base, &btl_endpoint->endpoint_send_event,
btl_endpoint->endpoint_sd,
OPAL_EV_WRITE | OPAL_EV_PERSIST,
mca_btl_tcp2_endpoint_send_handler,
btl_endpoint );
if(opal_list_get_size(&btl_endpoint->endpoint_frags) > 0) {
if(NULL == btl_endpoint->endpoint_send_frag)
btl_endpoint->endpoint_send_frag = (mca_btl_tcp2_frag_t*)
opal_list_remove_first(&btl_endpoint->endpoint_frags);
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
}
}
示例7: orte_rml_oob_fini
int
orte_rml_oob_fini(void)
{
opal_list_item_t *item;
while (NULL !=
(item = opal_list_remove_first(&orte_rml_oob_module.exceptions))) {
OBJ_RELEASE(item);
}
OBJ_DESTRUCT(&orte_rml_oob_module.exceptions);
OBJ_DESTRUCT(&orte_rml_oob_module.exceptions_lock);
OBJ_DESTRUCT(&orte_rml_oob_module.queued_routing_messages);
OBJ_DESTRUCT(&orte_rml_oob_module.queued_lock);
orte_rml_oob_module.active_oob->oob_exception_callback = NULL;
/* clear the base receive */
orte_rml_base_comm_stop();
return ORTE_SUCCESS;
}
示例8: orte_iof_base_callback_delete
int orte_iof_base_callback_delete(
const orte_process_name_t* proc,
int tag)
{
orte_iof_base_endpoint_t* endpoint;
opal_list_item_t* item;
OPAL_THREAD_LOCK(&orte_iof_base.iof_lock);
if(NULL == (endpoint = orte_iof_base_endpoint_lookup(proc,ORTE_IOF_SINK, tag))) {
OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock);
return ORTE_ERR_NOT_FOUND;
}
while(NULL != (item = opal_list_remove_first(&endpoint->ep_callbacks))) {
OBJ_RELEASE(item);
}
OBJ_RELEASE(endpoint);
OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock);
return ORTE_SUCCESS;
}
示例9: mca_oob_tcp_peer_send_handler
/*
* A file descriptor is available/ready for send. Check the state
* of the socket and take the appropriate action.
*/
static void mca_oob_tcp_peer_send_handler(int sd, short flags, void* user)
{
mca_oob_tcp_peer_t* peer = (mca_oob_tcp_peer_t *)user;
OPAL_THREAD_LOCK(&peer->peer_lock);
switch(peer->peer_state) {
case MCA_OOB_TCP_CONNECTING:
mca_oob_tcp_peer_complete_connect(peer);
break;
case MCA_OOB_TCP_CONNECTED:
{
while(peer->peer_send_msg != NULL) {
/* complete the current send */
mca_oob_tcp_msg_t* msg = peer->peer_send_msg;
if(mca_oob_tcp_msg_send_handler(msg, peer)) {
mca_oob_tcp_msg_complete(msg, &peer->peer_name);
} else {
break;
}
/* if current completed - progress any pending sends */
peer->peer_send_msg = (mca_oob_tcp_msg_t*)
opal_list_remove_first(&peer->peer_send_queue);
}
/* if nothing else to do unregister for send event notifications */
if(NULL == peer->peer_send_msg) {
opal_event_del(&peer->peer_send_event);
}
break;
}
default:
opal_output(0, "[%lu,%lu,%lu]-[%lu,%lu,%lu] mca_oob_tcp_peer_send_handler: invalid connection state (%d)",
ORTE_NAME_ARGS(orte_process_info.my_name),
ORTE_NAME_ARGS(&(peer->peer_name)),
peer->peer_state);
opal_event_del(&peer->peer_send_event);
break;
}
OPAL_THREAD_UNLOCK(&peer->peer_lock);
}
示例10: OPAL_THREAD_LOCK
static void *mca_oob_ud_complete_dispatch(int fd, int flags, void *context)
{
mca_oob_ud_req_t *req;
OPAL_THREAD_LOCK(&mca_oob_ud_component.ud_match_lock);
while (NULL !=
(req = (mca_oob_ud_req_t *) opal_list_remove_first (&mca_oob_ud_component.ud_event_queued_reqs))) {
OPAL_THREAD_UNLOCK(&mca_oob_ud_component.ud_match_lock);
OPAL_OUTPUT_VERBOSE((10, mca_oob_base_output, "%s oob:ud:event_process processing request %p",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), (void *) req));
req->req_list = NULL;
switch (req->type) {
case MCA_OOB_UD_REQ_RECV:
case MCA_OOB_UD_REQ_UNEX:
if (req->state == MCA_OOB_UD_REQ_COMPLETE) {
mca_oob_ud_recv_complete (req);
} else {
mca_oob_ud_req_append_to_list (req, &mca_oob_ud_component.ud_active_recvs);
mca_oob_ud_recv_try (req);
}
break;
case MCA_OOB_UD_REQ_SEND:
if (req->state == MCA_OOB_UD_REQ_COMPLETE) {
mca_oob_ud_send_complete (req, ORTE_SUCCESS);
} else {
mca_oob_ud_req_append_to_list (req, &mca_oob_ud_component.ud_active_sends);
mca_oob_ud_send_try (req);
}
break;
default:
break;
}
OPAL_THREAD_LOCK(&mca_oob_ud_component.ud_match_lock);
}
return NULL;
}
示例11: main
int main(int argc, char* argv[])
{
int i, j;
int found;
opal_list_t children;
opal_list_item_t *item;
int num_children;
int num_procs;
orte_routed_tree_t *child;
opal_bitmap_t *relations;
if (2 != argc) {
printf("usage: binom x, where x=number of procs\n");
exit(1);
}
orte_init(&argc, &argv, ORTE_PROC_TOOL);
num_procs = atoi(argv[1]);
for (i=0; i < num_procs; i++) {
OBJ_CONSTRUCT(&children, opal_list_t);
num_children = 0;
printf("i am %d:", i);
found = down_search(0, 0, i, num_procs, &num_children, &children, NULL);
printf("\tparent %d num_children %d\n", found, num_children);
while (NULL != (item = opal_list_remove_first(&children))) {
child = (orte_routed_tree_t*)item;
printf("\tchild %d\n", child->vpid);
for (j=0; j < num_procs; j++) {
if (opal_bitmap_is_set_bit(&child->relatives, j)) {
printf("\t\trelation %d\n", j);
}
}
OBJ_RELEASE(item);
}
OBJ_DESTRUCT(&children);
}
orte_finalize();
}
示例12: mca_oob_ud_peer_msg_timeout
static void mca_oob_ud_peer_msg_timeout (int fd, short event, void *ctx)
{
mca_oob_ud_peer_t *peer = (mca_oob_ud_peer_t *) ctx;
mca_oob_ud_msg_t *msg = (mca_oob_ud_msg_t *) opal_list_get_first (&peer->peer_flying_messages);
OPAL_THREAD_LOCK(&peer->peer_lock);
if (false == peer->peer_timer.active) {
return;
}
peer->peer_timer.active = false;
OPAL_OUTPUT_VERBOSE((10, mca_oob_base_output, "%s oob:ud:peer_msg_timeout timeout sending to peer "
"%s. first message = %" PRIu64 " which has length %d" , ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(&peer->peer_name), msg->hdr->msg_id, msg->wr.sg_list[0].length));
if (peer->peer_timer.tries == 0) {
opal_list_item_t *item;
while (NULL != (item = opal_list_remove_first (&peer->peer_flying_messages))) {
msg = (mca_oob_ud_msg_t *) item;
mca_oob_ud_msg_status_update (msg, MCA_OOB_UD_MSG_STATUS_TIMEOUT);
if (msg->req) {
mca_oob_ud_req_complete (msg->req, ORTE_ERR_TIMEOUT);
}
}
OPAL_THREAD_UNLOCK(&peer->peer_lock);
mca_oob_ud_peer_lost (peer);
return;
}
peer->peer_timer.tries--;
mca_oob_ud_peer_post_all (peer);
mca_oob_ud_peer_start_timer (peer);
OPAL_THREAD_UNLOCK(&peer->peer_lock);
}
示例13: mca_rcache_grdma_evict_lru_local
static inline bool mca_rcache_grdma_evict_lru_local (mca_rcache_grdma_cache_t *cache)
{
mca_rcache_grdma_module_t *rcache_grdma;
mca_rcache_base_registration_t *old_reg;
opal_mutex_lock (&cache->vma_module->vma_lock);
old_reg = (mca_rcache_base_registration_t *)
opal_list_remove_first (&cache->lru_list);
opal_mutex_unlock (&cache->vma_module->vma_lock);
if (NULL == old_reg) {
return false;
}
rcache_grdma = (mca_rcache_grdma_module_t *) old_reg->rcache;
(void) dereg_mem (old_reg);
rcache_grdma->stat_evicted++;
return true;
}
示例14: mca_btl_ugni_progress_send_wait_list
int mca_btl_ugni_progress_send_wait_list (mca_btl_base_endpoint_t *endpoint)
{
mca_btl_ugni_base_frag_t *frag;
int rc;
while (NULL !=
(frag = (mca_btl_ugni_base_frag_t *) opal_list_remove_first (&endpoint->frag_wait_list))) {
rc = mca_btl_ugni_send_frag (endpoint, frag);
if (OPAL_UNLIKELY(OMPI_SUCCESS > rc)) {
if (OPAL_LIKELY(OMPI_ERR_OUT_OF_RESOURCE == rc)) {
opal_list_prepend (&endpoint->frag_wait_list, (opal_list_item_t *) frag);
} else {
mca_btl_ugni_frag_complete (frag, rc);
}
return rc;
}
}
return OMPI_SUCCESS;
}
示例15: orte_ess_base_close
int
orte_ess_base_close(void)
{
opal_list_item_t *item;
mca_base_component_list_item_t *cli;
/* unload all remaining components */
while (NULL != (item = opal_list_remove_first(&orte_ess_base_components_available))) {
orte_ess_base_component_t* component;
cli = (mca_base_component_list_item_t *) item;
component = (orte_ess_base_component_t *) cli->cli_component;
opal_output_verbose(10, 0,
"orte_ess_base_close: module %s unloaded",
component->base_version.mca_component_name);
mca_base_component_repository_release((mca_base_component_t *) component);
OBJ_RELEASE(item);
}
OBJ_DESTRUCT(&orte_ess_base_components_available);
return ORTE_SUCCESS;
}