-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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 synchronization primitive fallbacks for Windows XP/Vista #27036
Conversation
Since Windows Vista has partial support for SRWLocks (the `TryAcquireSRWLock*` functions are missing,) the fallback functions for the synchronization primitives are grouped such that if any of the functions are unavailable, all of the fallback functions will be used instead.
(rust_highfive has picked a reviewer for you, use r? to override) |
One issue I haven't been able to resolve with this is that the test |
Nice work! This is a pretty meaty implementation with unfortunately very few tests, so I'm hoping that we can restructure things to make it work out a bit nicer. Can you start out by putting all implementation details in their own module? For example something like Also, can you investigate the performance implications of this custom implementation? I would expect the fallback implementation of a |
Got a mutex benchmark at https://gist.github.com/MrAlert/f4317ec44768284670bf but I'm having trouble running it on XP with the old implementation because the benchmark/test infrastructure depends on condition variables for something.
|
You can run the benchmark on a newer Windows version, right? (e.g. just make sure the wires are in place to use the fallback even if the new primitives are available) |
Well, yes, but the condition variable implementation expects SRWLocks, not critical sections...though I guess if the mutexes are forced to use critical sections unconditionally, I could make it use |
Hm, I believe that reentrant mutexes on windows are implemented with critical sections, so perhaps those could be temporarily exposed to benchmark? |
Alright. I think I got something working with mutexes forced to critical sections. At the very least, stage1 rustc is running without issues. |
☔ The latest upstream changes (presumably #28689) made this pull request unmergeable. Please resolve the merge conflicts. |
Closing due to inactivity, but feel free to send a new PR with my comments addressed! |
Since Windows Vista has partial support for SRWLocks (the
TryAcquireSRWLock*
functions are missing,) the fallback functionsfor the synchronization primitives are grouped such that if any of
the functions are unavailable, all of the fallback functions will be
used instead.
This at least partially addresses #26654.