1
1

adding a mutex for locking name and attributes in a communicator.

Adding a functions abstracting the setting of the name. 

This commit was SVN r1875.
Этот коммит содержится в:
Edgar Gabriel 2004-08-04 19:46:29 +00:00
родитель d1d4266328
Коммит 177d6ddae2
2 изменённых файлов: 22 добавлений и 1 удалений

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

@ -10,6 +10,7 @@
#include "communicator/communicator.h"
#include "datatype/datatype.h"
#include "proc/proc.h"
#include "threads/mutex.h"
#include "util/bit_ops.h"
#include "include/constants.h"
#include "mca/pcm/pcm.h"
@ -511,6 +512,21 @@ int ompi_comm_split ( ompi_communicator_t* comm, int color, int key,
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
int ompi_comm_set_name (ompi_communicator_t *comm, char *name )
{
OMPI_THREAD_LOCK(&(comm->c_lock));
memset(comm->c_name, 0, MPI_MAX_OBJECT_NAME);
strncpy(comm->c_name, name, MPI_MAX_OBJECT_NAME);
comm->c_name[MPI_MAX_OBJECT_NAME - 1] = 0;
comm->c_flags |= OMPI_COMM_NAMEISSET;
OMPI_THREAD_UNLOCK(&(comm->c_lock));
return OMPI_SUCCESS;
}
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/*
* Implementation of MPI_Allgather for the local_group in an inter-comm.
* The algorithm consists of two steps:

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

@ -16,6 +16,7 @@
#include "class/ompi_hash_table.h"
#include "attribute/attribute.h"
#include "request/request.h"
#include "threads/mutex.h"
extern ompi_class_t ompi_communicator_t_class;
@ -48,7 +49,8 @@ extern ompi_class_t ompi_communicator_t_class;
extern ompi_pointer_array_t ompi_mpi_communicators;
struct ompi_communicator_t {
ompi_object_t c_base;
ompi_object_t c_base;
ompi_mutex_t c_lock; /* mutex for name and attributes */
char c_name[MPI_MAX_OBJECT_NAME];
uint32_t c_contextid;
int c_my_rank;
@ -322,6 +324,9 @@ extern "C" {
int ompi_comm_nameunpublish ( char *service_name );
/* setting name */
int ompi_comm_set_name (ompi_communicator_t *comm, char *name );
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif