Skip to content

Commit

Permalink
Add threaded details & .hdf5.isThreadsafe (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
sshanks-kx authored Sep 21, 2022
1 parent e912005 commit bc60cf7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ This interface is in active developement and as such there are a number of use-c

If your use case requires the above functionality to be available, please open an issue [here](https://github.com/KxSystems/hdf5/issues). If you are capable, please consider contributing to the project.

## Threaded/Concurrent Access

Please view this [HDF5 FAQ article](https://portal.hdfgroup.org/display/knowledge/Questions+about+thread-safety+and+concurrent+access#Questionsaboutthread-safetyandconcurrentaccess-thread-safety) that explains when you can use threads (e.g. peach) or concurrently process files from multiple instances.

By default, our releases are not built with multi-thread support. Please download the source from our release page in order to build against your HDF5 library with threading enabled if you wish to avail of that functionality. It is recommended to use the standard non-thread safe version of hdf5 when not wishing to use multiple threads.

## Documentation

Documentation outlining the functionality available for this interface can be found [here](https://code.kx.com/q/interfaces/hdf5).
Expand Down
4 changes: 3 additions & 1 deletion q/hdf5.q
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ funcs:(
// .hdf5.writeAttrDataset[fname:C; dname:C; aname:C; dset:*; kdims:J; ktype:c]:_
(`hdf5version;1);
// .hdf5.version[]:S!J
(`hdf5isThreadsafe;1);
// .hdf5.isThreadsafe[]:b
(`hdf5errorOn;1);
// .hdf5.errorOn[]:_
(`hdf5errorOff;1);
Expand Down Expand Up @@ -123,4 +125,4 @@ readDictTab:{[fname;dname;typ]
// initialize
init[];

\d .
\d .
6 changes: 6 additions & 0 deletions src/hdf5_general.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ EXP K hdf5errorOff(K UNUSED(dummy)){
return KNL;
}

EXP K hdf5isThreadsafe(K UNUSED(dummy)){
hbool_t is;
H5is_library_threadsafe(&is);
return kb(is);
}

EXP K hdf5version(K UNUSED(dummy)){
unsigned int maj, min, rel;
if(H5get_libversion(&maj, &min, &rel) < 0)
Expand Down

0 comments on commit bc60cf7

Please sign in to comment.