Skip to content

Commit 4759891

Browse files
committed
Only conditionally call H5Pset_evict_on_close
1 parent 26046fb commit 4759891

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

hdf5/src/hl/plist/file_access.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,8 +1440,13 @@ impl FileAccessBuilder {
14401440
v.min_raw_perc as _,
14411441
));
14421442
}
1443-
if let Some(v) = self.evict_on_close {
1444-
h5try!(H5Pset_evict_on_close(id, hbool_t::from(v)));
1443+
if let Some(evict) = self.evict_on_close {
1444+
// Issue #259: H5Pset_evict_on_close is not allowed to be called
1445+
// even if the argument is `false` on e.g. parallel/mpio setups
1446+
let has_evict_on_close = h5get!(H5Pget_evict_on_close(id): hbool_t).map(|x| x > 0);
1447+
if evict != has_evict_on_close.unwrap_or(false) {
1448+
h5try!(H5Pset_evict_on_close(id, hbool_t::from(evict)));
1449+
}
14451450
}
14461451
if let Some(v) = self.mdc_image_config {
14471452
let v = v.into();

0 commit comments

Comments
 (0)