Skip to content
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

Fix condition variable wait #436

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

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.

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