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

Risk of Spurious Wakeups - Conditional Variable Usage with if Statement #522

Open
octopus-kkk opened this issue Feb 27, 2025 · 1 comment

Comments

@octopus-kkk
Copy link

Hi, developers,
I came across the following code snippet, where the condition for waiting on the condition variable is checked using an if statement:
platforms/windows/src/tests/mod.rs#L224

Could this potentially lead to spurious wakeups? Would it be better to use a while loop instead to ensure the condition is rechecked after each wakeup?

@mwcampbell
Copy link
Contributor

@octopus-kkk Thanks for the report. This is in the test harness, so it's not a bug in production code. Still, feel free to submit a PR that fixes it.

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

No branches or pull requests

2 participants