about summary refs log tree commit diff
path: root/library/std/src/sync/poison
AgeCommit message (Collapse)AuthorLines
2025-09-22Mutex/RwLock/ReentrantLock::data_ptr to be const fnPeter Lyons Kehl-2/+2
2025-09-13fix Condvar::wait_timeout docsRalf Jung-5/+4
2025-08-23fix visibility of private gettersConnor Tsui-2/+4
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
2025-08-23move `WaitTimeoutResult` up to `mod.rs`Connor Tsui-65/+1
Since `WaitTimeoutResult` is poison-agnostic, we want to use the same type for both variants of `Condvar`. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
2025-08-22Rollup merge of #144648 - connortsui20:nonpoison_rwlock, r=Mark-SimulacrumJacob Pratt-327/+372
Implementation: `#[feature(nonpoison_rwlock)]` Tracking Issue: https://github.com/rust-lang/rust/issues/134645 This PR continues the effort made in https://github.com/rust-lang/rust/pull/144022 by adding the implementation of `nonpoison::rwlock`. Many of the changes here are similar to the changes made to implement `nonpoison::mutex`. The only real difference is that this PR includes a reorganizing of the existing `poison::rwlock` file that hopefully makes both variants more readable. ### Related PRs - `nonpoison_condvar` implementation: https://github.com/rust-lang/rust/pull/144651 - `nonpoison_once` implementation: https://github.com/rust-lang/rust/pull/144653
2025-08-16run spellcheck as a tidy extra check in cibinarycat-1/+1
2025-08-09reorganize rwlock fileConnor Tsui-327/+372
This commit is a purely cosmetic change to the documentation and ordering of items in the `rwlock.rs` file, which will help discern the actual difference between the `nonpoison` and `poison` variants of `rwlock`. List of changes (lots of small things): - Clean up some of the existing field doc comments - Add documentation for every field in struct definitions - Consolidate related implementation blocks (1 implementation block per guard instead of 2) - Use the lifetime name `'rwlock` instead of `'a` - Reorder implementation blocks to be consistent across the entire file (follows the order `ReadGuard`, `WriteGuard`, `MappedReadGuard`, MappedWriteGuard`) - Move simple trait implementations to the bottom of the file - Rename the `poison` field in `MappedRwLockWriteGuard` to posion_guard` - Cut off comments at 100 columns - Update the documentation of `downgrade` to match stabilization PR # 143191
2025-08-02Rollup merge of #144185 - purplesyringa:poisoning-wording, r=AmanieuSamuel Tardieu-14/+72
Document guarantees of poisoning This mostly documents the current behavior of `Mutex` and `RwLock` (rust-lang/rust#143471) as imperfect. It's unlikely that the situation improves significantly in the future, and even if it does, the rules will probably be more complicated than "poisoning is completely reliable", so this is a conservative guarantee. We also explicitly specify that `OnceLock` never poisons, even though it has an API similar to mutexes. Fixes rust-lang/rust#143471 by improving documentation. r? ``@Amanieu``
2025-07-29clean up existing poison filesConnor Tsui-2/+2
2025-07-25Add a note on foreign exceptionsAlisa Sireneva-0/+3
2025-07-25Add a list of failure conditions for poisoningAlisa Sireneva-4/+19
2025-07-25Link to Mutex poisoning docs from RwLock docsAlisa Sireneva-1/+3
2025-07-19Document guarantees of poisoningAlisa Sireneva-14/+52
This mostly documents the current behavior of `Mutex` and `RwLock` as imperfect. It's unlikely that the situation improves significantly in the future, and even if it does, the rules will probably be more complicated than "poisoning is completely reliable", so this is a conservative guarantee. We also explicitly specify that `OnceLock` never poisons, even though it has an API similar to mutexes.
2025-06-26Fix RwLock::try_write documentation for WouldBlock conditionkrikera-1/+1
2025-05-21Add more docs to new data_ptr methodsJonas Platte-0/+10
2025-05-21Add data_ptr method to Mutex and RwLockJonas Platte-0/+12
2025-04-30Rename `(Mapped)(RwLock|Mutex)Guard::try_map` to `filter_map`.Zachary S-41/+35
1. analogous to std::cell::Ref(Mut)::filter_map. 2. doesn't imply `Try` genericizability.
2025-04-03std: clarify RwLock::get_mut more clearlyxizheyin-1/+3
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-03-31std: clarify Mutex::get_mut more clearlyxizheyin-1/+5
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-02-18update version placeholdersJosh Stone-2/+2
(cherry picked from commit e4840ce59bdddb19394df008c5c26d9c493725f8)
2025-02-04Rollup merge of #135621 - bjorn3:move_tests_to_stdtests, r=NoratriebJacob Pratt-1535/+0
Move some std tests to integration tests Unit tests directly inside of standard library crates require a very fragile way of building that is hard to reproduce outside of bootstrap. Follow up to https://github.com/rust-lang/rust/pull/133859
2025-02-01Rollup merge of #136360 - slanterns:once_wait, r=tgross35Matthias Krüger-4/+2
Stabilize `once_wait` Closes: https://github.com/rust-lang/rust/issues/127527. `@rustbot` label: +T-libs-api r? libs-api
2025-02-01docs: Documented Send and Sync requirements for Mutex + MutexGuardRoss Sullivan-2/+30
2025-02-01stabilize `once_wait`Slanterns-4/+2
2025-01-26Move std::sync unit tests to integration testsbjorn3-1535/+0
This removes two minor OnceLock tests which test private methods. The rest of the tests should be more than enough to catch mistakes in those private methods. Also makes ReentrantLock::try_lock public. And finally it makes the mpmc tests actually run.
2025-01-06chore: remove redundant words in commentcrystalstall-1/+1
Signed-off-by: crystalstall <crystalruby@qq.com>
2025-01-02Move some things to `std::sync::poison` and reexport them in `std::sync`Pavel Grigorenko-0/+4538