forked from HDFGroup/hdf5
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement assert-based virtual locks on IDs #7
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Nov 14, 2024
062140b
to
1f74b5b
Compare
3f05a46
to
fe632c0
Compare
1f74b5b
to
fb1ef77
Compare
fe632c0
to
005ab57
Compare
fb1ef77
to
b8e4cab
Compare
80bced4
to
855ea52
Compare
b8e4cab
to
2ad4f09
Compare
855ea52
to
b3b95e1
Compare
2ad4f09
to
80a50a5
Compare
ea71c8c
to
7c3bdd3
Compare
80a50a5
to
2978a6e
Compare
7c3bdd3
to
06258ba
Compare
2978a6e
to
4cf1d75
Compare
b17a009
to
8879327
Compare
4cf1d75
to
2f7d9a9
Compare
cb61a02
to
fc31a40
Compare
fc31a40
to
767abbe
Compare
767abbe
to
5e03095
Compare
77f8d6e
to
9dec79b
Compare
de44883
to
53303f3
Compare
11b157c
to
510adb7
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement virtual locks for IDs
When the library is built in debug mode, H5I will track how many concurrent API routines reference application-exposed IDs passed in through the H5VL API, and throw an assertion if an ID is simultaneously provided to more library threads than its reference count permits. The purpose of this is to help multi-threaded application developers detect invalid API usage early on in development.
The virtual locks are implemented by allowing variants of the
FUNC_ENTER
andFUNC_LEAVE
macros to take a variable numbers of IDs as additional arguments.The
_NOINIT
enter/exit variants do not interact with the virtual locks, since routines using these macros generally aren't meant to be directly used by applications (e.g. the routines for passthrough VOLs inH5VLcallback.c
).There are a few other factors the virtual locks must consider which complicate the implementation somewhat:
H5VLunregister_connector()
). If using a simple virtual lock scheme, a routine that decrements the app ref count before calling the virtual lock exit would create a region where another thread could, on entry, apparently find the ID exceeding its application reference count, even though the usage is valid. The solution is that routines which decrement the app ref count indicate that an "application unlock" has taken place on the ID. Verification of ID ref counts compare the virtual lock count to the sum of application references plus 'application unlocks'. The application unlock count also serves to prevent double-counting of virtual lock releases inH5I_vlock_exit()
.