#include "gmxfio.h"
#include "md5.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
static t_fileio *open_files = NULL;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* this mutex locks the open_files structure so that no two threads can
modify it.
type of access to the fio's elements. */
void gmx_fio_lock(t_fileio *fio)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Lock_lock(&(fio->mtx));
#endif
}
/* unlock the mutex associated with this fio. */
void gmx_fio_unlock(t_fileio *fio)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Lock_unlock(&(fio->mtx));
#endif
}
open_files->fn=NULL;
open_files->next=open_files;
open_files->prev=open_files;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Lock_init(&(open_files->mtx));
#endif
}
static void gmx_fio_insert(t_fileio *fio)
{
t_fileio *prev;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* first lock the big open_files mutex. */
tMPI_Thread_mutex_lock(&open_file_mutex);
#endif
gmx_fio_unlock(open_files);
gmx_fio_unlock(fio);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* now unlock the big open_files mutex. */
tMPI_Thread_mutex_unlock(&open_file_mutex);
#endif
t_fileio *ret;
/* first lock the big open_files mutex and the dummy's mutex */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* first lock the big open_files mutex. */
tMPI_Thread_mutex_lock(&open_file_mutex);
#endif
if (fio->next==open_files)
{
ret=NULL;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&open_file_mutex);
#endif
}
static void gmx_fio_stop_getting_next(t_fileio *fio)
{
gmx_fio_unlock(fio);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&open_file_mutex);
#endif
}
}
snew(fio, 1);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Lock_init(&(fio->mtx));
#endif
bRead = (newmode[0]=='r' && newmode[1]!='+');
{
int rc = 0;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* first lock the big open_files mutex. */
/* We don't want two processes operating on the list at the same time */
tMPI_Thread_mutex_lock(&open_file_mutex);
sfree(fio);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&open_file_mutex);
#endif