-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Move futex locks to sys_common
#104329
Closed
Closed
Move futex locks to sys_common
#104329
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
cfg_if::cfg_if! { | ||
if #[cfg(any( | ||
target_os = "android", | ||
target_os = "dragonfly", | ||
all(target_os = "emscripten", target_feature = "atomics"), | ||
target_os = "freebsd", | ||
target_os = "hermit", | ||
target_os = "linux", | ||
target_os = "openbsd", | ||
all(any(target_arch = "wasm32", target_arch = "wasm64"), target_feature = "atomics"), | ||
))] { | ||
mod futex_mutex; | ||
mod futex_rwlock; | ||
mod futex_condvar; | ||
pub(crate) use futex_mutex::Mutex; | ||
pub(crate) use futex_rwlock::RwLock; | ||
pub(crate) use futex_condvar::Condvar; | ||
} else if #[cfg(target_os = "fuchsia")] { | ||
mod futex_rwlock; | ||
mod futex_condvar; | ||
pub(crate) use crate::sys::locks::Mutex; | ||
pub(crate) use futex_rwlock::RwLock; | ||
pub(crate) use futex_condvar::Condvar; | ||
} else { | ||
pub(crate) use crate::sys::locks::{Mutex, RwLock, Condvar}; | ||
} | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This probably isn't the right place either because sys_common shouldn't contain platform cfg() stuff even though tidy currently doesn't complain about it either.
I was going to suggest moving it to
sys::common
instead but its mod.rs does sayrust/library/std/src/sys/common/mod.rs
Lines 1 to 5 in cd12888
So the #[path] seems to be the approved way already.
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.
Since this concerns other code like the thread parker and one-time initialization as well, I suggest we discuss this in #84187 (the tracking issue for that guideline).
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 want to devalue the contributions of anyone who has worked on libstd, but this mostly seems like it was one person's idea 2 years ago about what would be a good organization of stuff, tbh. Since then we've sprouted a lot more small niche mostly-tier-3 targets that are mostly just repeats of Linux or other POSIX platforms, yet with enough annoying variations that they induce quite a lot of configuration around that. I think we should revisit those guidelines heavily.