-void smpi_comm_unuse(MPI_Comm comm){
- if (comm == MPI_COMM_UNINITIALIZED)
- comm = smpi_process_comm_world();
- comm->refcount--;
- smpi_group_unuse(comm->group);
- if(comm->refcount==0){
+void smpi_comm_cleanup_attributes(MPI_Comm comm){
+ if(comm->attributes !=NULL){
+ xbt_dict_cursor_t cursor = NULL;
+ int* key;
+ void * value;
+ int flag;
+ xbt_dict_foreach(comm->attributes, cursor, key, value){
+ smpi_comm_key_elem elem =
+ static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null(smpi_comm_keyvals, (const char*)key));
+ if(elem && elem->delete_fn)
+ elem->delete_fn(comm, *key, value, &flag);
+ }
+ xbt_dict_free(&comm->attributes);
+ }
+}
+
+void smpi_comm_cleanup_smp(MPI_Comm comm){