int gmx_fio_close(t_fileio *fio) { int rc = 0; /* 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); if (fio->iFTP == efTNG) { gmx_incons("gmx_fio_close should not be called on a TNG file"); } gmx_fio_lock(fio); /* first remove it from the list */ gmx_fio_remove(fio); rc = gmx_fio_close_locked(fio); gmx_fio_unlock(fio); sfree(fio->fn); sfree(fio); tMPI_Thread_mutex_unlock(&open_file_mutex); return rc; }
int gmx_fio_fclose(FILE *fp) { t_fileio *cur; t_fileio *found = NULL; int rc = -1; cur = gmx_fio_get_first(); while (cur) { if (cur->fp == fp) { rc = gmx_fio_close_locked(cur); gmx_fio_remove(cur); gmx_fio_stop_getting_next(cur); break; } cur = gmx_fio_get_next(cur); } return rc; }
int gmx_fio_close(t_fileio *fio) { int rc = 0; #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); #endif gmx_fio_lock(fio); /* first remove it from the list */ gmx_fio_remove(fio); rc = gmx_fio_close_locked(fio); gmx_fio_unlock(fio); sfree(fio); #ifdef GMX_THREAD_MPI tMPI_Thread_mutex_unlock(&open_file_mutex); #endif return rc; }