@@ -114,7 +114,7 @@ mod internal_prelude {
114114pub mod test;
115115
116116/// Returns the runtime version of the HDF5 library.
117- pub fn hdf5_version ( ) -> ( u8 , u8 , u8 ) {
117+ pub fn library_version ( ) -> ( u8 , u8 , u8 ) {
118118 use self :: internal_prelude:: c_uint;
119119 use hdf5_sys:: h5:: H5get_libversion ;
120120 let mut v: ( c_uint , c_uint , c_uint ) = ( 0 , 0 , 0 ) ;
@@ -123,12 +123,27 @@ pub fn hdf5_version() -> (u8, u8, u8) {
123123 . unwrap_or ( ( 0 , 0 , 0 ) )
124124}
125125
126+ /// Returns true if the HDF5 library is threadsafe.
127+ pub fn is_library_threadsafe ( ) -> bool {
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+ }
139+ }
140+
126141#[ cfg( test) ]
127142pub mod tests {
128- use super :: hdf5_version ;
143+ use crate :: library_version ;
129144
130145 #[ test]
131- pub fn test_hdf5_version ( ) {
132- assert ! ( hdf5_version ( ) >= ( 1 , 8 , 4 ) ) ;
146+ pub fn test_library_version ( ) {
147+ assert ! ( library_version ( ) >= ( 1 , 8 , 4 ) ) ;
133148 }
134149}
0 commit comments