Skip to content

Commit

Permalink
Rely on file open flag to enable SWMR rather than manual start
Browse files Browse the repository at this point in the history
  • Loading branch information
ZedThree committed Mar 7, 2023
1 parent cbbb873 commit ccdc9ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
8 changes: 0 additions & 8 deletions libhdf5/hdf5create.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,6 @@ nc4_create_file(const char *path, int cmode, size_t initialsz,
if ((retval = NC4_new_provenance(nc4_info)))
BAIL(retval);

#ifdef HDF5_HAS_SWMR
if ((cmode & NC_HDF5_SWMR)) {
/* Prepare for single writer multiple readers */
if ((retval = H5Fstart_swmr_write(hdf5_info->hdfid)))
BAIL(retval);
}
#endif

return NC_NOERR;

exit: /*failure exit*/
Expand Down
14 changes: 5 additions & 9 deletions libhdf5/hdf5open.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,11 @@ nc4_open_file(const char *path, int mode, void* parameters, int ncid)
/* Determine the HDF5 open flag to use. */
if((mode & NC_WRITE)) {
flags = H5F_ACC_RDWR;
#ifdef HDF5_HAS_SWMR
if((mode & NC_HDF5_SWMR)) {
flags |= H5F_ACC_SWMR_WRITE;
}
#endif
} else {
flags = H5F_ACC_RDONLY;
#ifdef HDF5_HAS_SWMR
Expand Down Expand Up @@ -1003,15 +1008,6 @@ nc4_open_file(const char *path, int mode, void* parameters, int ncid)
if (H5Pclose(fapl_id) < 0)
BAIL(NC_EHDFERR);

#ifdef HDF5_HAS_SWMR
/* Prepare for single writer multiple reader. */
if (mode & NC_WRITE && mode & NC_HDF5_SWMR) {
if ((retval = H5Fstart_swmr_write(h5->hdfid))) {
BAIL(retval);
}
}
#endif

return NC_NOERR;

exit:
Expand Down

0 comments on commit ccdc9ff

Please sign in to comment.