Due to the C++ bindings not being thread-safe, I was hoping to turn off thread-safety in the C core and handle synchronization in my code. This turned out to be impossible because the HDF5 core uses
global, non-thread-specific data structures when H5_HAVE_THREADSAFE is 
undefined. There does not
appear to be a way to turn off internal synchronization while keeping thread or 
instance specific
data structures. That would be useful. SQLite has good semantics for thread 
safety:

http://www.sqlite.org/compile.html#threadsafe
This option controls whether or not code is included in SQLite to enable it to 
operate safely in
a multithreaded environment. The default is SQLITE_THREADSAFE=1 which is safe 
for use in a
multithreaded environment. When compiled with SQLITE_THREADSAFE=0 all mutexing 
code is omitted
and it is unsafe to use SQLite in a multithreaded program. When compiled with
SQLITE_THREADSAFE=2, SQLite can be used in a multithreaded program so long as 
no two threads
attempt to use the same database connection at the same time.

At the very least it would be useful if the documentation specifies that H5_HAVE_THREADSAFE controls both the use of global data structures and synchronization. I had to dig into the code to understand it.

Thanks,
-Matt

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to