How exactly is async-i/o available in HDF5?

I think I know what is happening. I think I need 2 different H5ESwait(), correct?

As the first H5ESwait() will wait for

H5Fopen_async(es_id);
H5Dopen_async(es_id);
H5Dread_async(es_id);

but wont wait anymore for

H5Dclose_async(es_id);
H5Fclose_async(es_id);

which causes issues as the event set tried to close immediately while both closes are still to be executed.

Making so the first call to H5ESwait() waits for the file operations to finish and then the second H5ESwait() to wait for the closing operations to finish works, which does make a lot of sense actually as both closes get added to the event set again.

I then completely misunderstood your remark from the other thread about:

Looking back at your program, you should make sure that the calls to H5Dclose_async() and H5Fclose_async() come after the call to H5ESwait(). Otherwise, H5ESclose() should fail if there are any active operations going on in the event set being closed.

I had not thought about that those async operations need their own wait again as well.