Skip to content

Commit

Permalink
Support is_library_threadsafe() for older HDF5
Browse files Browse the repository at this point in the history
  • Loading branch information
aldanor committed Aug 16, 2019
1 parent af91410 commit e49f828
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/lib.rs
Expand Up @@ -125,10 +125,17 @@ pub fn library_version() -> (u8, u8, u8) {

/// Returns true if the HDF5 library is threadsafe.
pub fn is_library_threadsafe() -> bool {
use self::internal_prelude::hbool_t;
use hdf5_sys::h5::H5is_library_threadsafe;
let mut ts: hbool_t = 0;
h5call!(H5is_library_threadsafe(&mut ts)).map(|_| ts > 0).unwrap_or(false)
#[cfg(hdf5_1_8_16)]
{
use self::internal_prelude::hbool_t;
use hdf5_sys::h5::H5is_library_threadsafe;
let mut ts: hbool_t = 0;
h5call!(H5is_library_threadsafe(&mut ts)).map(|_| ts > 0).unwrap_or(false)
}
#[cfg(not(hdf5_1_8_16))]
{
cfg!(h5_have_threadsafe)
}
}

#[cfg(test)]
Expand Down

0 comments on commit e49f828

Please sign in to comment.