-
Notifications
You must be signed in to change notification settings - Fork 849
ts::shared_mutex - Fix lock counting for debug #9040
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
Conversation
Lock count variable was left uninitialized, causing assertions to fail. This change initializes the debug data so they work properly. Also add a similar check to the locking side.
| X(std::atomic<bool> _exclusive;) | ||
| X(std::atomic<int> _shared;) | ||
| X(std::atomic<bool> _exclusive{false};) | ||
| X(std::atomic<int> _shared{0};) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to this: https://en.cppreference.com/w/cpp/atomic/atomic/atomic
The default constructor is trivial: no initialization takes place other than zero initialization of static and thread-local objects. std::atomic_init may be used to complete initialization.
I also ran into an uninitialized value during local testing, which drove this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, sorry, I thought the std::atomic constructor always zero initialized, even for stack instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem!
|
Cherry-picked to v9.2.x |
Lock count variable was left uninitialized, causing assertions to fail. This change initializes the debug data so they work properly. Also add a similar check to the locking side. (cherry picked from commit 2e31ef8)
Lock count variable was left uninitialized, causing assertions to fail. This change initializes the debug data so they work properly. Also add a similar check to the locking side.
* asf/9.2.x: Updated ChangeLog utilize proxy.config.hostdb.host_file.interval config variable (apache#9039) Remove plugin parent_select unused symbols (apache#9023) Require use of 'override' keyword when valid. (apache#8737) Fix compile error on macOS (apache#9047) Validate that content length header matches object size on cache read (apache#8976) Fix reload memory leak (apache#9041) Update prepare_proxy_verifier.sh to work in non-git directories (apache#9048) Change linux/fs include to build with glibc 2.36 (apache#9027) ts::shared_mutex - Fix lock counting for debug (apache#9040)
Lock count variable was left uninitialized, causing assertions to fail.
This change initializes the debug data so they work properly. Also add
a similar check to the locking side.