Skip to content

Commit ca5eb20

Browse files
authored
Merge pull request #160 from mulimoen/bugfix/dont_atexit
Prevent hdf5 calling atexit()
2 parents 40654f1 + 4fdfdf1 commit ca5eb20

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
are now generic over size only: `FixedAscii<N>` and `FixedUnicode<N>`.
7272
- The version of `hdf5` built in `hdf5-src` has been updated from `1.10.6` to `1.10.7`.
7373
- The `zlib` dependency is no longer included with `default-features`.
74+
- `hdf5` no longer calls `H5close` automatically on program exit.
7475

7576
## 0.7.1
7677

src/globals.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ use crate::internal_prelude::*;
1818

1919
lazy_static! {
2020
static ref LIBRARY_INIT: () = {
21-
h5lock!(::hdf5_sys::h5::H5open());
21+
h5lock!({
22+
// Ensure hdf5 does not invalidate handles which might
23+
// still be live on other threads on program exit
24+
::hdf5_sys::h5::H5dont_atexit();
25+
::hdf5_sys::h5::H5open();
26+
});
2227
let _e = crate::hl::filters::register_filters();
2328
};
2429
}

src/hl/plist/dataset_create.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ impl DatasetCreate {
729729
h5try!(H5Pget_fill_value(self.id(), dtype.id(), buf.as_mut_ptr().cast()));
730730
Ok(Some(unsafe { OwnedDynValue::from_raw(tp.clone(), buf) }))
731731
}
732-
_ => Ok(None),
732+
FillValue::Undefined => Ok(None),
733733
}
734734
}
735735

src/hl/plist/file_create.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,9 @@ impl FileCreateBuilder {
413413
FileSpaceStrategy::PageAggregation => {
414414
(H5F_fspace_strategy_t::H5F_FSPACE_STRATEGY_AGGR, 0, 0)
415415
}
416-
_ => (H5F_fspace_strategy_t::H5F_FSPACE_STRATEGY_NONE, 0, 0),
416+
FileSpaceStrategy::None => {
417+
(H5F_fspace_strategy_t::H5F_FSPACE_STRATEGY_NONE, 0, 0)
418+
}
417419
};
418420
h5try!(H5Pset_file_space_strategy(id, strategy, persist, threshold));
419421
}

src/hl/selection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ where
448448
Dout: ndarray::Dimension,
449449
{
450450
fn from(slice: ndarray::SliceInfo<T, Din, Dout>) -> Self {
451-
slice.deref().as_ref().iter().cloned().map(Into::into).collect::<Vec<_>>().into()
451+
slice.deref().as_ref().iter().copied().map(Into::into).collect::<Vec<_>>().into()
452452
}
453453
}
454454

0 commit comments

Comments
 (0)