1
1

- Be sure to unlock, even in error cases

- Be sure to propagate errors upward in the case of copy_all() and
  delete_all() 

This commit was SVN r3249.
Этот коммит содержится в:
Jeff Squyres 2004-10-20 22:55:53 +00:00
родитель e9162d8fa7
Коммит bba9b27575

Просмотреть файл

@ -43,6 +43,9 @@
((ompi_##type##_t *)object, \ ((ompi_##type##_t *)object, \
key, attribute, \ key, attribute, \
key_item->extra_state)) != MPI_SUCCESS) {\ key_item->extra_state)) != MPI_SUCCESS) {\
if (need_lock) { \
OMPI_THREAD_UNLOCK(&alock); \
} \
return err;\ return err;\
} \ } \
} }
@ -58,6 +61,7 @@
if ((err = (*((hash_value->copy_attr_fn).attr_##type##_copy_fn)) \ if ((err = (*((hash_value->copy_attr_fn).attr_##type##_copy_fn)) \
((ompi_##type##_t *)old_object, key, hash_value->extra_state, \ ((ompi_##type##_t *)old_object, key, hash_value->extra_state, \
old_attr, &new_attr, &flag)) != MPI_SUCCESS) { \ old_attr, &new_attr, &flag)) != MPI_SUCCESS) { \
OMPI_THREAD_UNLOCK(&alock); \
return err; \ return err; \
}\ }\
} }
@ -571,7 +575,7 @@ int
ompi_attr_delete_all(ompi_attribute_type_t type, void *object, ompi_attr_delete_all(ompi_attribute_type_t type, void *object,
ompi_hash_table_t *keyhash) ompi_hash_table_t *keyhash)
{ {
int ret; int key_ret, del_ret;
uint32_t key, oldkey; uint32_t key, oldkey;
void *node, *in_node, *old_attr; void *node, *in_node, *old_attr;
@ -594,10 +598,11 @@ ompi_attr_delete_all(ompi_attribute_type_t type, void *object,
OMPI_THREAD_LOCK(&alock); OMPI_THREAD_LOCK(&alock);
/* Get the first key in local CWD hash */ /* Get the first key in local CWD hash */
ret = ompi_hash_table_get_first_key_uint32(keyhash, key_ret = ompi_hash_table_get_first_key_uint32(keyhash,
&key, &old_attr, &key, &old_attr,
&node); &node);
while (OMPI_SUCCESS == ret) { del_ret = OMPI_SUCCESS;
while (OMPI_SUCCESS == key_ret && OMPI_SUCCESS == del_ret) {
/* Save this node info for deletion, before we move onto the /* Save this node info for deletion, before we move onto the
next node */ next node */
@ -607,16 +612,16 @@ ompi_attr_delete_all(ompi_attribute_type_t type, void *object,
/* Move to the next node */ /* Move to the next node */
ret = ompi_hash_table_get_next_key_uint32(keyhash, key_ret = ompi_hash_table_get_next_key_uint32(keyhash,
&key, &old_attr, &key, &old_attr,
in_node, &node); in_node, &node);
/* Now delete this attribute */ /* Now delete this attribute */
ompi_attr_delete(type, object, keyhash, oldkey, true, false); del_ret = ompi_attr_delete(type, object, keyhash, oldkey, true, false);
} }
/* All done */ /* All done */
OMPI_THREAD_UNLOCK(&alock); OMPI_THREAD_UNLOCK(&alock);
return MPI_SUCCESS; return del_ret;
} }