-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Do not wrap platform locks in sys_common
#100505
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
This comment has been minimized.
This comment has been minimized.
759f351
to
f8ba559
Compare
… and `StaticRwLock`
f8ba559
to
361cd7b
Compare
Always good to see a PR that removes more code than it adds. ^^ It's quite a large PR though, affecting a lot of different things, so it'd be good if you could split it up a bit. Then if this accidentally causes some issues later, it'll be easier to track down.
|
target_os = "espidf" | ||
target_os = "espidf", | ||
target_os = "horizon", |
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.
Why did this change? This seems unrelated to this PR.
Now that
Mutex
andRwLock
areconst
,StaticMutex
andStaticRwLock
are no longer necessary. Removing them results in a extra few allocations on platforms which require boxed locks (currently some UNIXes and SGX), but it makes the codebase quite a lot cleaner. With the lock improvements tracked in #93740, these allocations will become unnecessary.The rest of the lock abstractions in
sys_common
can be removed by modifying the lock implementations insys
so that they areconst
and movable on all platforms. This entails a slight bit of code duplication (both SGX and UNIX need to wrap their locks inLazyBox
, for now), but reduces the usage ofunsafe
quite considerably.The
Condvar
check is merged into thepthread_condvar
implementation, makingsys_common::condvar
redundant. The check is otherwise only performed on SGX and Hermit, which however do not rely on the check for soundness. I therefore removed it on these platforms, as it will be made redundant by the aforementioned lock improvements anyway.Additionally, this PR makes the condition variable on Hermit movable by lazily initializing it in place instead of lazily allocating and initializing.
@rustbot label +T-libs, +T-libs-api
r? @m-ou-se