Since each API context is local to a thread, use the stack to
store the context instead of allocating & releasing it each time.
This improves performance (slightly), reduces alloc/free calls,
and eliminates the H5FL package from the push & pop operations,
which helps simplify threadsafe operation.
One effect of this change is that the H5VLstart_lib_state /
H5VLfinish_lib_state API routines for pass through connector
authors now require a parameter that can be used to store
the library's context. It was probably a mistake to assume
that these two routines would not do this previously, so this
is essentially a bug fix for them.
Some other minor things:
* Added API context push+pop operations to cache tests
(I'm not actually certain why this was working before) and
a few other places
* Cleaned up a bunch of warnings in test code (calloc args, mainly)
* Made header file inclusions more standard in some source files
Also cleans up the links test, which had a ton of copy-and-pasted incorrect negative error checks (Calling TEST_ERROR within H5E_BEGIN_TRY / H5E_END_TRY pairs will goto out of the pair, leaving errors suppressed).
This is where most people will expect to find license information. The
COPYING_LBNL_HDF5 file has also been renamed to LICENSE_LBNL_HDF5.
The licenses are unchanged.
* Fix for issue #4849 that settings in fapl libver bounds causes unexpected H5Fopen failures.
File with non-SWMR-write access can now be opened without regard for superblock version.
Due to the fix, H5Fstart_swmr_write() also needs to be modified as well as the tests for libver bounds.
The "RFC: Setting Bounds for Object Creation in HDF5 1.10.0" is also updated to reflect the changes.
* Fix c++ libver bound test failure.
Added setup and cleanup callback parameters to TestInit() to perform
setup and cleanup tasks once for whole test program
Removed TestCleanup() function since its functionality is covered by
PerformTests()
Added check of the HDF5_NOCLEANUP environment variable in
GetTestCleanup()
Cleanup and prepare for thread-safety changes.
Big ideas:
* Wrap H5VL_class_t with H5VL_connector_t, so use of the class can be refcounted within the H5VL package, instead of relying on storing an ID within the H5VL_t struct and incrementing & decrementing the ID's refcount.
* Register H5VL_connector_t* for VOL connector IDs, instead of the H5VL_class_t*
* Stop other packages from rummaging around inside H5VL_connector_t and H5VL_object_t data structures, so that the H5VL package can change implementation details without coupled changes throughout the library
Small things:
* Simplified the coding for creating links
* Moved some routines into more logical locations
Added new testframe.h header to document testing framework functions and
split them away from h5test.h and from test programs that don't
integrate with the testframe.c testing framework
Added new test setup callback to testframe.c testing framework
Added parameters to AddTest() to specify size of test parameters so they
can be copied for later use
Enabled HDF5 error stacks in testframe.c framework by default and added
some error stack suppressions to some testhdf5 tests
Added new maxthreads option to testframe.c framework to allow specifying
the maximum number of threads a multi-threaded test can use
Moved TestExpress functionality out of testframe.c and into more general
h5test.c for wider use by tests through getter and setter
Updated some tests to not mix and match functionality between h5test.c/h
and testframe.c/h
Moved some functionality from testphdf5.h into testpar.h for parallel
tests that aren't part of testphdf5
Added new parallel test library that contains common shared
functionality for parallel tests (similar to h5test library)
In H5F__accum_reset(), when H5F__accum_flush() failed, the freeing of
f_sh->accum.buf was never reached, causing resource leak.
@fortnern added the third argument to H5F__accum_reset() so we can free
f_sh->accum.buf when we close the file, that is, when H5F__accum_reset()
is called from the H5F__dest() route, and can leave the accumulator in place
otherwise.
Rename existing recursive R/W locks from H5TS_rw_lock_t to H5TS_rec_rwlock_t, so it's more obvious that they are recursive.
Add non-recursive R/W lock, H5TS_rwlock_t
Add spinlock, H5TS_spinlock_t
Add an atomic void pointer, H5TS_atomic_voidp_t
User's application segfaulted because the returned value H5I_BADID wasn't
detected when H5I_get_type() was called. This PR adds checks for invalid
file/group identifiers passed into H5Gmove2.
This defect occurs in many other places, hence, issue GH-4764.
Fixes#4737
The t_pmulti_dset and t_select_io_dset tests rely on the behavior
of the previous private rand_r-like implementation to get the
correct sequence of random numbers to pass. This has been restored
using a fully private rand_r-like implementation that doesn't
rely on rand_r and will work on Windows and other platforms
where rand_r doesn't exist.
- Verified that the listed functions do not include null terminator in the returned length
- Improved some of the tests
- Corrected documentation
Fixes GH-4704
* Casted a positive int to size_t
* Fix incorrect VOL vs. non-VOL calls
H5Lget_info2() called H5I_object() instead of H5VL_vol_object() crashed
user application.
This is a wide-spread issue (GH-4730) but this PR only addresses GH-4705.
* Remove an incorrect change
Added functionality tests for the following APIs:
H5Rget_file_name
H5Rget_obj_name
H5Rget_attr_name
Also removed "+1" when returning a name length in H5R__get_attr_name().
The exter "+1" gave an incorrect value for the length of the referenced
object's attribute name.
Fixed GH-4447
* Fix Fortran test
The C API H5Rget_attr_name incorrectly added 1 to the length of the
referenced object's attribute name, so the Fortran API h5rget_attr_name_f
removed 1 from the returned value to accommodate the incorrectness.
This PR fixes H5Rget_attr_name so this workaround in h5rget_attr_name_f
is no longer needed.
* Add test H5Aget_name against H5Rget_attr_name
Complete overhaul of the concurrency-related aspects of the library (threading, atomics, locking, etc.), adding private routines in the H5TS package to allow internal algorithms to use all of these capabilities.
Adds many new features & components in the H5TS package that are equivalent to common concurrency data structures and capabilities: "regular" and recursive mutices, condition variables, semaphores, thread barriers, 'once' support, thread pools, atomic variables, thread-local keys, and spawning & joining internal threads.
Now supports C11, pthreads, and Windows threading for all H5TS capabilities, except the recursive readers/writers lock, which is not supported on Windows (because Windows threads don't provide a callback on thread-local variable deletion).
The "global" API lock is switched to use a recursive mutex from the H5TS package, instead of its own variant.
API context code (H5CX package) and error stacks (H5E package) now use the common thread-local info, instead of their own variants.
Subfiling code is switched from using Mercury threading features to the new internal H5TS features.
Removes the mercury threading code.
Adds a configure option (--enable-threads / HDF5_ENABLE_THREADS), enabled by default, to control whether threading is enabled within the library.
* Replace incorrect use of an internal function
In some API functions, the internal function H5I_object() was used instead
of H5I_object_verify(), which verifies the type of an ID argument. So
when an inappropriate ID was passed in to the affected API, it was accepted.
This behavior can cause issues at a later time, including a segfault, as
reported in issue #GH-4656.
The fix was applied to the following functions:
H5Fget_intent()
H5Fget_fileno()
H5Fget_freespace()
H5Fget_create_plist()
H5Fget_access_plist()
H5Fget_vfd_handle()
H5Dvlen_get_buf_size()
H5Fget_mdc_config()
H5Fset_mdc_config()
H5Freset_mdc_hit_rate_stats()
Fixes GH-4662
* Reworked cleaning up test files, only removing test files if present to account for skipped tests
* changed to using H5Fis_accessible
* update to full use of remove_test_file