Activate thread-safe and enable-cxx in HDF5

Hi all,
I just ran into the problem, that my c++ HDF5 application has to be thread safe. I stumbled across a post 2 years ago[0], which desribes that --enable-threadsafe _and_ --enable-cxx does not work together.
I guess this is still up to date, since the configuration aborts with the configuration error "incompatible flags".

Can somebody briefly explain, where and why the c++ wrapper for the c API of HDF5 is not thread safe?
I am thinking of implementing my own mutex, but this does not seem to be correct. Also, I do not know which part of the c++ is not thread safe.

Any suggestions?

Your help is much appreciated,
~Mathias

[0] http://mail.hdfgroup.org/pipermail/hdf-forum_hdfgroup.org/2009-June/000135.html

Hi Mathias,

···

On May 27, 2011, at 1:30 PM, Mathias Wilhelm wrote:

Hi all,
I just ran into the problem, that my c++ HDF5 application has to be thread safe. I stumbled across a post 2 years ago[0], which desribes that --enable-threadsafe _and_ --enable-cxx does not work together.
I guess this is still up to date, since the configuration aborts with the configuration error "incompatible flags".

Can somebody briefly explain, where and why the c++ wrapper for the c API of HDF5 is not thread safe?
I am thinking of implementing my own mutex, but this does not seem to be correct. Also, I do not know which part of the c++ is not thread safe.

Any suggestions?

  We don't test that configuration (because we don't have any demand from organizations that fund our company), so it might work without any problem, but we're not sure. If you'd like to give it a try, you can use the "--enable-unsupported" configure flag and see if things are working for you.

  Quincey

Hi Quincey,
Quincey Koziol wrote:

I just ran into the problem, that my c++ HDF5 application has to be thread safe. I stumbled across a post 2 years ago[0], which desribes that --enable-threadsafe _and_ --enable-cxx does not work together.
I guess this is still up to date, since the configuration aborts with the configuration error "incompatible flags".
Any suggestions?

  We don't test that configuration (because we don't have any demand from organizations that fund our company), so it might work without any problem, but we're not sure. If you'd like to give it a try, you can use the "--enable-unsupported" configure flag and see if things are working for you.

To make a long story short:
Using --enable-unsupported works under linux and windows 7 or higher.

But:
My application has to operate under Windows XP. So I "replaced" the InitOnceExecuteOnce() call with boost::call_once. My test case of writing and reading multiple HDF5 files passes without any problems, so I anticipate that the application is thread safe, but shows a strange behavior if only H5::H5File::isHdf5() is called:
If the application invokes H5::H5File::isHdf5() and terminates right after it, HDF5 reports a "infinite loop closing library"[0].
If the application invokes H5::H5File::isHdf5() and opens the file for read/write access, the application completes without any errors. The same if H5::H5File::isHdf5() is not invoked at all. boost::call_once is invoked in all three cases. However, the error only occurs under windows so I guess it is because of my hack.

In order to fix this:
Can anyone guess what the problem is?
I can not see a reason why the application terminates with this error after invoking isHdf5 without any further operations.

What does the sequence of letters mean and if it is not important, can I suppress this warning?

~Mathias

[0] D,T,F,FD,P,FD,P,FD,P,E,E,E,E,E,E,.....

···

On May 27, 2011, at 1:30 PM, Mathias Wilhelm wrote:

Hi again,
Mathias Wilhelm wrote:

But:
I "replaced" the InitOnceExecuteOnce() call with boost::call_once. My test case of writing and reading multiple HDF5 files passes without any problems, so I anticipate that the application is thread safe, but shows a strange behavior if only H5::H5File::isHdf5() is called:
If the application invokes H5::H5File::isHdf5() and terminates right after it, HDF5 reports a "infinite loop closing library"[0].
If the application invokes H5::H5File::isHdf5() and opens the file for read/write access, the application completes without any errors. The same if H5::H5File::isHdf5() is not invoked at all.

To complete this story:
I removed the isHdf5 call in all cases and my application terminates
without any errors. I still do not know what the problem is but,
unfortunately, do not have the time to dig deeper.

I intend to test the boost::call_once hack under windows and will let you know what the outcome is.

~Mathias