#include "statutil.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
static t_pstack *pstack=NULL;
static gmx_bool bUnbuffered=FALSE;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* this linked list is an intrinsically globally shared object, so we have
to protect it with mutexes */
static tMPI_Thread_mutex_t pstack_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
{
t_pstack *ps;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&pstack_mutex);
#endif
ps->fp = fp;
ps->prev = pstack;
pstack = ps;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
#endif
}
#else
t_pstack *ps,*tmp;
int ret=0;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&pstack_mutex);
#endif
ret = fclose(fp);
}
}
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
#endif
return ret;
void frewind(FILE *fp)
{
t_pstack *ps;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&pstack_mutex);
#endif
while (ps != NULL) {
if (ps->fp == fp) {
fprintf(stderr,"Cannot rewind compressed file!\n");
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
#endif
return;
ps=ps->prev;
}
rewind(fp);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
#endif
}
gmx_bool is_pipe(FILE *fp)
{
t_pstack *ps;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&pstack_mutex);
#endif
ps=pstack;
while (ps != NULL) {
if (ps->fp == fp) {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
#endif
return TRUE;
}
ps=ps->prev;
}
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
#endif
return FALSE;