Skip to content

Commit e49f828

Browse files
committed
Support is_library_threadsafe() for older HDF5
1 parent af91410 commit e49f828

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/lib.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,17 @@ pub fn library_version() -> (u8, u8, u8) {
125125

126126
/// Returns true if the HDF5 library is threadsafe.
127127
pub fn is_library_threadsafe() -> bool {
128-
use self::internal_prelude::hbool_t;
129-
use hdf5_sys::h5::H5is_library_threadsafe;
130-
let mut ts: hbool_t = 0;
131-
h5call!(H5is_library_threadsafe(&mut ts)).map(|_| ts > 0).unwrap_or(false)
128+
#[cfg(hdf5_1_8_16)]
129+
{
130+
use self::internal_prelude::hbool_t;
131+
use hdf5_sys::h5::H5is_library_threadsafe;
132+
let mut ts: hbool_t = 0;
133+
h5call!(H5is_library_threadsafe(&mut ts)).map(|_| ts > 0).unwrap_or(false)
134+
}
135+
#[cfg(not(hdf5_1_8_16))]
136+
{
137+
cfg!(h5_have_threadsafe)
138+
}
132139
}
133140

134141
#[cfg(test)]

0 commit comments

Comments
 (0)