about summary refs log tree commit diff
path: root/library/std/src/sync/poison.rs
AgeCommit message (Collapse)AuthorLines
2022-06-19Auto merge of #97791 - m-ou-se:const-locks, r=m-ou-sebors-0/+1
Make {Mutex, Condvar, RwLock}::new() const. This makes it possible to have `static M: Mutex<_> = Mutex::new(..);` 🎉 Our implementations [on Linux](https://github.com/rust-lang/rust/pull/95035), [on Windows](https://github.com/rust-lang/rust/pull/77380), and various BSDs and some tier 3 platforms have already been using a non-allocating const-constructible implementation. As of https://github.com/rust-lang/rust/pull/97647, the remaining platforms (most notably macOS) now have a const-constructible implementation as well. This means we can finally make these functions publicly const. Tracking issue: https://github.com/rust-lang/rust/issues/93740
2022-06-09Avoid `thread::panicking()` in non-poisoning methods of `Mutex` and `RwLock`Josh Stone-1/+8
`Mutex::lock()` and `RwLock::write()` are poison-guarded against panics, in that they set the poison flag if a panic occurs while they're locked. But if we're already in a panic (`thread::panicking()`), they leave the poison flag alone. That check is a bit of a waste for methods that never set the poison flag though, namely `get_mut()`, `into_inner()`, and `RwLock::read()`. These use-cases are now split to avoid that unnecessary call.
2022-06-06Make all {Mutex, Condvar, RwLock}::new #[inline].Mara Bos-0/+1
2022-04-26Add functions to un-poison Mutex and RwLockThayne McCombs-0/+5
See discussion at https://internals.rust-lang.org/t/unpoisoning-a-mutex/16521/3
2022-03-10Use implicit capture syntax in format_argsT-O-R-U-S-1/+1
This updates the standard library's documentation to use the new syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored).
2021-07-29Fix may not to appropriate might not or must notAli Malik-1/+1
2021-04-22Move `sys_common::poison` to `sync::poison`Christiaan Dirkx-0/+259