Rollup merge of #102277 - mgeisler:rwlock, r=m-ou-se

Consistently write `RwLock`

Before the documentation sometimes referred to an "rwlock" and sometimes to "`RwLock`".
This commit is contained in:
Yuki Okushi 2022-10-11 18:37:52 +09:00 committed by GitHub
commit 387df55f26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -167,7 +167,7 @@ pub const fn new(t: T) -> RwLock<T> {
}
impl<T: ?Sized> RwLock<T> {
/// Locks this rwlock with shared read access, blocking the current thread
/// Locks this `RwLock` with shared read access, blocking the current thread
/// until it can be acquired.
///
/// The calling thread will be blocked until there are no more writers which
@ -181,9 +181,10 @@ impl<T: ?Sized> RwLock<T> {
///
/// # Errors
///
/// This function will return an error if the RwLock is poisoned. An RwLock
/// is poisoned whenever a writer panics while holding an exclusive lock.
/// The failure will occur immediately after the lock has been acquired.
/// This function will return an error if the `RwLock` is poisoned. An
/// `RwLock` is poisoned whenever a writer panics while holding an exclusive
/// lock. The failure will occur immediately after the lock has been
/// acquired.
///
/// # Panics
///
@ -215,7 +216,7 @@ pub fn read(&self) -> LockResult<RwLockReadGuard<'_, T>> {
}
}
/// Attempts to acquire this rwlock with shared read access.
/// Attempts to acquire this `RwLock` with shared read access.
///
/// If the access could not be granted at this time, then `Err` is returned.
/// Otherwise, an RAII guard is returned which will release the shared access
@ -228,13 +229,13 @@ pub fn read(&self) -> LockResult<RwLockReadGuard<'_, T>> {
///
/// # Errors
///
/// This function will return the [`Poisoned`] error if the RwLock is poisoned.
/// An RwLock is poisoned whenever a writer panics while holding an exclusive
/// lock. `Poisoned` will only be returned if the lock would have otherwise been
/// acquired.
/// This function will return the [`Poisoned`] error if the `RwLock` is
/// poisoned. An `RwLock` is poisoned whenever a writer panics while holding
/// an exclusive lock. `Poisoned` will only be returned if the lock would
/// have otherwise been acquired.
///
/// This function will return the [`WouldBlock`] error if the RwLock could not
/// be acquired because it was already locked exclusively.
/// This function will return the [`WouldBlock`] error if the `RwLock` could
/// not be acquired because it was already locked exclusively.
///
/// [`Poisoned`]: TryLockError::Poisoned
/// [`WouldBlock`]: TryLockError::WouldBlock
@ -263,20 +264,20 @@ pub fn try_read(&self) -> TryLockResult<RwLockReadGuard<'_, T>> {
}
}
/// Locks this rwlock with exclusive write access, blocking the current
/// Locks this `RwLock` with exclusive write access, blocking the current
/// thread until it can be acquired.
///
/// This function will not return while other writers or other readers
/// currently have access to the lock.
///
/// Returns an RAII guard which will drop the write access of this rwlock
/// Returns an RAII guard which will drop the write access of this `RwLock`
/// when dropped.
///
/// # Errors
///
/// This function will return an error if the RwLock is poisoned. An RwLock
/// is poisoned whenever a writer panics while holding an exclusive lock.
/// An error will be returned when the lock is acquired.
/// This function will return an error if the `RwLock` is poisoned. An
/// `RwLock` is poisoned whenever a writer panics while holding an exclusive
/// lock. An error will be returned when the lock is acquired.
///
/// # Panics
///
@ -303,7 +304,7 @@ pub fn write(&self) -> LockResult<RwLockWriteGuard<'_, T>> {
}
}
/// Attempts to lock this rwlock with exclusive write access.
/// Attempts to lock this `RwLock` with exclusive write access.
///
/// If the lock could not be acquired at this time, then `Err` is returned.
/// Otherwise, an RAII guard is returned which will release the lock when
@ -316,13 +317,13 @@ pub fn write(&self) -> LockResult<RwLockWriteGuard<'_, T>> {
///
/// # Errors
///
/// This function will return the [`Poisoned`] error if the RwLock is
/// poisoned. An RwLock is poisoned whenever a writer panics while holding
/// an exclusive lock. `Poisoned` will only be returned if the lock would have
/// otherwise been acquired.
/// This function will return the [`Poisoned`] error if the `RwLock` is
/// poisoned. An `RwLock` is poisoned whenever a writer panics while holding
/// an exclusive lock. `Poisoned` will only be returned if the lock would
/// have otherwise been acquired.
///
/// This function will return the [`WouldBlock`] error if the RwLock could not
/// be acquired because it was already locked exclusively.
/// This function will return the [`WouldBlock`] error if the `RwLock` could
/// not be acquired because it was already locked exclusively.
///
/// [`Poisoned`]: TryLockError::Poisoned
/// [`WouldBlock`]: TryLockError::WouldBlock
@ -422,10 +423,10 @@ pub fn clear_poison(&self) {
///
/// # Errors
///
/// This function will return an error if the RwLock is poisoned. An RwLock
/// is poisoned whenever a writer panics while holding an exclusive lock. An
/// error will only be returned if the lock would have otherwise been
/// acquired.
/// This function will return an error if the `RwLock` is poisoned. An
/// `RwLock` is poisoned whenever a writer panics while holding an exclusive
/// lock. An error will only be returned if the lock would have otherwise
/// been acquired.
///
/// # Examples
///
@ -455,10 +456,10 @@ pub fn into_inner(self) -> LockResult<T>
///
/// # Errors
///
/// This function will return an error if the RwLock is poisoned. An RwLock
/// is poisoned whenever a writer panics while holding an exclusive lock. An
/// error will only be returned if the lock would have otherwise been
/// acquired.
/// This function will return an error if the `RwLock` is poisoned. An
/// `RwLock` is poisoned whenever a writer panics while holding an exclusive
/// lock. An error will only be returned if the lock would have otherwise
/// been acquired.
///
/// # Examples
///