HDF5.jl icon indicating copy to clipboard operation
HDF5.jl copied to clipboard

h5_is_library_threadsafe() gives unreliable results due to unspecified initial value

Open david-macmahon opened this issue 1 year ago • 1 comments

HDF5.API.h5_is_library_threadsafe() has an unspecified initial value in src/api/helpers.jl:

function h5_is_library_threadsafe()
    is_ts = Ref{Cuint}()
    h5_is_library_threadsafe(is_ts)
    return is_ts[] > 0
end

and H5is_library_threadsafe only updates the low 8 bits:

julia> is_ts=Ref{Cuint}(-1 % Cuint)
Base.RefValue{UInt32}(0xffffffff)

julia> ccall((:H5is_library_threadsafe, HDF5.API.libhdf5), HDF5.API.herr_t, (Ref{Cuint},), is_ts);

julia> is_ts[]
0xffffff00

david-macmahon avatar Jan 19 '24 23:01 david-macmahon

Would you mind opening a pull request?

simonbyrne avatar Jan 19 '24 23:01 simonbyrne