Skip to content

Fix condition variable wait #436

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

Merged
merged 14 commits into from
Mar 17, 2025

Conversation

lo-simon
Copy link
Collaborator

Windows boost::condition_variable_any::wait would throw nested lock exceptions when boost::shared_mutex has reached the
maximum number of exclusive_waiting locks. This problem occurs inside the boost::basic_condition_variable::do_wait_until
when relocker is out of scope. This could cause program termination due to unhandled exceptions.
@garethsb reports this problem in #315.

@lo-simon lo-simon marked this pull request as ready for review February 22, 2025 10:30
@@ -0,0 +1,444 @@
// based on the <boost/thread/win32/condition_variable.hpp>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the file's version of Boost in this comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed in

Comment on lines +66 to +73
void lock()
{
if (_unlocked)
{
_lock.lock();
_unlocked = false;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any possibility of lock() throwing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is by design. The caller of the wait call can catch the throw and re-wait again.

lo-simon and others added 6 commits March 12, 2025 17:00
Co-authored-by: jonathan-r-thorpe <64410119+jonathan-r-thorpe@users.noreply.github.com>
Co-authored-by: jonathan-r-thorpe <64410119+jonathan-r-thorpe@users.noreply.github.com>
@jonathan-r-thorpe
Copy link
Contributor

LGTM

@jonathan-r-thorpe jonathan-r-thorpe merged commit a3ca89a into sony:master Mar 17, 2025
9 checks passed
@jonathan-r-thorpe jonathan-r-thorpe deleted the fix-condition-variable-wait branch March 17, 2025 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants