Add value accessor methods to Mutex and RwLock#133406
Merged
bors merged 1 commit intorust-lang:masterfrom Dec 15, 2024
Merged
Conversation
Collaborator
|
r? @Noratrieb rustbot has assigned @Noratrieb. Use |
5 tasks
5d2f4af to
2c98df2
Compare
Noratrieb
reviewed
Nov 24, 2024
Noratrieb
reviewed
Nov 24, 2024
2c98df2 to
b6446a1
Compare
Contributor
Author
|
@rustbot ready |
kennytm
reviewed
Nov 28, 2024
f0d47da to
85fd82b
Compare
85fd82b to
242c6c3
Compare
Noratrieb
approved these changes
Dec 14, 2024
Member
Noratrieb
left a comment
There was a problem hiding this comment.
The docs changes to the lock result are fine, moving the writing about the guard being contained to the methods explicitly probably makes it more clear even without the new use of the result.
Member
|
@bors r+ |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 15, 2024
Rollup of 7 pull requests Successful merges: - rust-lang#130361 (std::net: Solaris supports `SOCK_CLOEXEC` as well since 11.4.) - rust-lang#133406 (Add value accessor methods to `Mutex` and `RwLock`) - rust-lang#133633 (don't show the full linker args unless `--verbose` is passed) - rust-lang#134285 (Add some convenience helper methods on `hir::Safety`) - rust-lang#134310 (Add clarity to the examples of some `Vec` & `VecDeque` methods) - rust-lang#134313 (Don't make a def id for `impl_trait_in_bindings`) - rust-lang#134315 (A couple of polonius fact generation cleanups) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 15, 2024
Rollup merge of rust-lang#133406 - EFanZh:lock-value-accessors, r=Noratrieb Add value accessor methods to `Mutex` and `RwLock` - ACP: rust-lang/libs-team#485. - Tracking issue: rust-lang#133407. This PR adds `get`, `set` and `replace` methods to the `Mutex` and `RwLock` types for quick access to their contained values. One possible optimization would be to check for poisoning first and return an error immediately, without attempting to acquire the lock. I didn’t implement this because I consider poisoning to be relatively rare, adding this extra check could slow down common use cases.
tautschnig
added a commit
to tautschnig/verify-rust-std
that referenced
this pull request
Jan 17, 2025
get,setandreplacemethods toMutexandRwLocklibs-team#485.lock_value_accessors#133407.This PR adds
get,setandreplacemethods to theMutexandRwLocktypes for quick access to their contained values.One possible optimization would be to check for poisoning first and return an error immediately, without attempting to acquire the lock. I didn’t implement this because I consider poisoning to be relatively rare, adding this extra check could slow down common use cases.