/* * Delete all the attributes on an MPI object */ int ompi_attr_delete_all(ompi_attribute_type_t type, void *object, opal_hash_table_t *attr_hash) { int key_ret, del_ret; uint32_t key, oldkey; void *node, *in_node, *old_attr; /* Ensure that the table is not empty */ if (NULL == attr_hash) { return MPI_SUCCESS; } /* Lock this whole sequence of events -- don't let any other thread modify the structure of the attribute hash or bitmap while we're traversing it */ OPAL_THREAD_LOCK(&attr_hash_lock); /* Get the first key in local object's hash */ key_ret = opal_hash_table_get_first_key_uint32(attr_hash, &key, &old_attr, &node); OPAL_THREAD_UNLOCK(&attr_hash_lock); del_ret = OMPI_SUCCESS; while (OMPI_SUCCESS == key_ret && OMPI_SUCCESS == del_ret) { /* Save this node info for deletion, before we move onto the next node */ in_node = node; oldkey = key; /* Move to the next node */ OPAL_THREAD_LOCK(&attr_hash_lock); key_ret = opal_hash_table_get_next_key_uint32(attr_hash, &key, &old_attr, in_node, &node); OPAL_THREAD_UNLOCK(&attr_hash_lock); /* Now delete this attribute */ del_ret = ompi_attr_delete(type, object, attr_hash, oldkey, true); } /* All done */ return del_ret; }
int MPI_Win_delete_attr(MPI_Win win, int win_keyval) { int ret; if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_win_invalid(win)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_WIN, FUNC_NAME); } } OPAL_CR_ENTER_LIBRARY(); ret = ompi_attr_delete(WIN_ATTR, win, win->w_keyhash, win_keyval, false, true); OMPI_ERRHANDLER_RETURN(ret, win, MPI_ERR_OTHER, FUNC_NAME); }