-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Remove synchronization from Windows hashmap_random_keys
#99371
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
@ChrisDenton: no appropriate reviewer found, use r? to override |
r? rust-lang/libs |
r? libs |
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.
I don't think it's that unfortunate. This is a lot cleaner anyway, and should be more efficient for cases that don't need the fallback.
In the future if we care about the cost of the extra syscall when BCryptGenRandom
isn't supported, we could use an AtomicPtr to recover that1
That said, thiis seems more robust than that would be, and I suspect optimizing for the "no BCryptGenRandom
" case doesn't matter.
Footnotes
-
It would start out as
preferred_rng
, and get assigned tofallback_rng
on error. This is similar to how we handle the flags we use forgetrandom
on linux. ↩
@bors r+ |
Rollup of 5 pull requests Successful merges: - rust-lang#99371 (Remove synchronization from Windows `hashmap_random_keys`) - rust-lang#99614 (do not claim that transmute is like memcpy) - rust-lang#99738 (rustdoc: avoid inlining modules with duplicate names) - rust-lang#99800 (Fix futex module imports on wasm+atomics) - rust-lang#100079 (Replace `* -> vec` with `-> vec` in docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Unfortunately using synchronization when generating hashmap keys can prevent it being used in
DllMain
.Fixes #99341