Skip to content
Snippets Groups Projects
Commit fa991ca5 authored by Elias Pipping's avatar Elias Pipping
Browse files

HDF5: Warn if SWMR is requested but unavailable

parent 638c69d5
No related branches found
No related tags found
No related merge requests found
......@@ -42,10 +42,15 @@ public:
bool const fileExists = stat(filename.c_str(), &buffer) == 0;
unsigned int flags = fileExists ? H5F_ACC_RDWR : H5F_ACC_EXCL;
if (swmr) {
#if H5_VERSION_GE(1, 10, 0)
if (swmr)
flags |= H5F_ACC_SWMR_WRITE;
#else
std::cerr
<< "WARNING: SWMR requested but not supported by this version of HDF5"
<< std::endl;
#endif
}
file_ = fileExists ? H5Fopen(filename.c_str(), flags, fapl)
: H5Fcreate(filename.c_str(), flags, H5P_DEFAULT, fapl);
......@@ -69,6 +74,10 @@ public:
#if H5_VERSION_GE(1, 10, 0)
swmrEnabled_ = true;
H5Fstart_swmr_write(file_);
#else
std::cerr
<< "WARNING: SWMR requested but not supported by this version of HDF5"
<< std::endl;
#endif
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment