1
1

fix a bug in the unnamed semaphore section that was introduced when I tried to unify the named and unnamed semaphore logic.

Этот коммит содержится в:
Edgar Gabriel 2015-07-24 10:05:07 -05:00
родитель 57c301f25a
Коммит c91cb67787
4 изменённых файлов: 9 добавлений и 9 удалений

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

@ -100,9 +100,9 @@ int mca_sharedfp_sm_iwrite (mca_io_ompio_file_t *fh,
/*--------------------------------------------------------------*
*Structures and definitions only for this component
*--------------------------------------------------------------*/
#define OMPIO_SHAREDFP_USE_UNNAMED_SEMAPHORES 1
struct sm_offset{
sem_t *mutex; /* the mutex: a Posix memory-based unnamed semaphore */
sem_t mutex; /* the mutex: a Posix memory-based unnamed semaphore */
long long offset; /* and the shared file pointer offset */
};

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

@ -185,9 +185,9 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
MPI_Offset position=0;
#ifdef OMPIO_SHAREDFP_USE_UNNAMED_SEMAPHORES
sem_wait(sm_offset_ptr->mutex);
sem_wait(&sm_offset_ptr->mutex);
sm_offset_ptr->offset=position;
sem_post(sm_offset_ptr->mutex);
sem_post(&sm_offset_ptr->mutex);
#else
sem_wait(sm_data->mutex);
sm_offset_ptr->offset=position;
@ -236,7 +236,7 @@ int mca_sharedfp_sm_file_close (mca_io_ompio_file_t *fh)
if (file_data->sm_offset_ptr) {
/* destroy semaphore */
#ifdef OMPIO_SHAREDFP_USE_UNNAMED_SEMAPHORES
sem_destroy(file_data->sm_offset_ptr->mutex);
sem_destroy(&file_data->sm_offset_ptr->mutex);
#else
sem_unlink (file_data->sem_name);
free (file_data->sem_name);

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

@ -49,7 +49,7 @@ int mca_sharedfp_sm_request_position(struct mca_sharedfp_base_data_t * sh,
/* Aquire an exclusive lock */
#ifdef OMPIO_SHAREDFP_USE_UNNAMED_SEMAPHORES
sem_wait(sm_offset_ptr->mutex);
sem_wait(&sm_offset_ptr->mutex);
#else
sem_wait(sm_data->mutex);
#endif
@ -75,7 +75,7 @@ int mca_sharedfp_sm_request_position(struct mca_sharedfp_base_data_t * sh,
}
#ifdef OMPIO_SHAREDFP_USE_UNNAMED_SEMAPHORES
sem_post(sm_offset_ptr->mutex);
sem_post(&sm_offset_ptr->mutex);
#else
sem_post(sm_data->mutex);
#endif

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

@ -122,7 +122,7 @@ mca_sharedfp_sm_seek (mca_io_ompio_file_t *fh,
sm_offset_ptr = sm_data->sm_offset_ptr;
#ifdef OMPIO_SHAREDFP_USE_UNNAMED_SEMAPHORES
sem_wait(sm_offset_ptr->mutex);
sem_wait(&sm_offset_ptr->mutex);
#else
sem_wait(sm_data->mutex);
#endif
@ -135,7 +135,7 @@ mca_sharedfp_sm_seek (mca_io_ompio_file_t *fh,
printf("sharedfp_sm_seek: Releasing sm lock...rank=%d",rank); fflush(stdout);
}
#ifdef OMPIO_SHAREDFP_USE_UNNAMED_SEMAPHORES
sem_post(sm_offset_ptr->mutex);
sem_post(&sm_offset_ptr->mutex);
#else
sem_post(sm_data->mutex);
#endif