Skip to content

Commit

Permalink
Update helpers.jl with initial value for Ref{Cuint} (#1138)
Browse files Browse the repository at this point in the history
* Update helpers.jl with initial value for Ref{Cuint}

Fixes #1137

* Switch to using Cuchar

---------

Co-authored-by: Mark Kittisopikul <[email protected]>
Co-authored-by: Mark Kittisopikul <[email protected]>
  • Loading branch information
3 people committed Apr 5, 2024
1 parent a3a903f commit 5b94c0a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gen/api_defs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@bind h5_free_memory(buf::Ptr{Cvoid})::herr_t "Error freeing memory"
@bind h5_garbage_collect()::herr_t "Error on garbage collect"
@bind h5_get_libversion(majnum::Ref{Cuint}, minnum::Ref{Cuint}, relnum::Ref{Cuint})::herr_t "Error getting HDF5 library version"
@bind h5_is_library_threadsafe(is_ts::Ref{Cuint})::herr_t "Error determining thread safety"
@bind h5_is_library_threadsafe(is_ts::Ref{Cuchar})::herr_t "Error determining thread safety"
@bind h5_open()::herr_t "Error initializing the HDF5 library"
@bind h5_set_free_list_limits(reg_global_lim::Cint, reg_list_lim::Cint, arr_global_lim::Cint, arr_list_lim::Cint, blk_global_lim::Cint, blk_list_lim::Cint)::herr_t "Error setting limits on free lists"

Expand Down
4 changes: 2 additions & 2 deletions src/api/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ function h5_get_libversion(majnum, minnum, relnum)
end

"""
h5_is_library_threadsafe(is_ts::Ref{Cuint})
h5_is_library_threadsafe(is_ts::Ref{Cuchar})
See `libhdf5` documentation for [`H5is_library_threadsafe`](https://docs.hdfgroup.org/hdf5/v1_14/group___h5.html#ga70bfde4acd009cdd7bcd2f54c594e28a).
"""
function h5_is_library_threadsafe(is_ts)
lock(liblock)
var"#status#" = try
ccall((:H5is_library_threadsafe, libhdf5), herr_t, (Ref{Cuint},), is_ts)
ccall((:H5is_library_threadsafe, libhdf5), herr_t, (Ref{Cuchar},), is_ts)
finally
unlock(liblock)
end
Expand Down
2 changes: 1 addition & 1 deletion src/api/helpers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function h5_get_libversion()
end

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

0 comments on commit 5b94c0a

Please sign in to comment.