diff --git a/reader/JFJochHDF5Reader.cpp b/reader/JFJochHDF5Reader.cpp index afc162ca..9acbc39a 100644 --- a/reader/JFJochHDF5Reader.cpp +++ b/reader/JFJochHDF5Reader.cpp @@ -98,7 +98,7 @@ std::string dataset_name(const std::string& path) { } void JFJochHDF5Reader::ReadFile(const std::string& filename) { - std::unique_lock ul(file_mutex); + std::unique_lock ul(hdf5_mutex); try { auto dataset = std::make_shared(); master_file = std::make_unique(filename); @@ -448,7 +448,7 @@ void JFJochHDF5Reader::ReadFile(const std::string& filename) { } uint64_t JFJochHDF5Reader::GetNumberOfImages() const { - std::unique_lock ul(file_mutex); + std::unique_lock ul(hdf5_mutex); return number_of_images; } @@ -490,7 +490,7 @@ bool JFJochHDF5Reader::LoadImage_i(std::shared_ptr &dataset std::vector &buffer, int64_t image_number, bool update_dataset) { - std::unique_lock ul(file_mutex); + std::unique_lock ul(hdf5_mutex); if (!dataset) return {}; @@ -709,7 +709,7 @@ bool JFJochHDF5Reader::LoadImage_i(std::shared_ptr &dataset } void JFJochHDF5Reader::Close() { - std::unique_lock ul(file_mutex); + std::unique_lock ul(hdf5_mutex); master_file = {}; number_of_images = 0; legacy_format_files.clear(); diff --git a/reader/JFJochHDF5Reader.h b/reader/JFJochHDF5Reader.h index b7603869..914050ab 100644 --- a/reader/JFJochHDF5Reader.h +++ b/reader/JFJochHDF5Reader.h @@ -8,7 +8,6 @@ #include "../writer/HDF5Objects.h" class JFJochHDF5Reader : public JFJochReader { - mutable std::mutex file_mutex; std::unique_ptr master_file; std::vector legacy_format_files; diff --git a/writer/HDF5Objects.cpp b/writer/HDF5Objects.cpp index 81442a88..df243072 100644 --- a/writer/HDF5Objects.cpp +++ b/writer/HDF5Objects.cpp @@ -869,7 +869,10 @@ std::string HDF5Object::GetString(const std::string &name, const std::string &de } bool HDF5Object::Exists(const std::string &name) const { - return H5Lexists(GetID(), name.c_str(), H5P_DEFAULT) > 0; + H5E_BEGIN_TRY { + return H5Lexists(GetID(), name.c_str(), H5P_DEFAULT) > 0; + } H5E_END_TRY; + return false; } herr_t func(hid_t group, const char *name, const H5L_info2_t *info, void *op_data) {