Update documentation for RwLock::try_{read,write}.

This commit is contained in:
John Gallagher 2015-05-06 11:47:30 -04:00
parent 30b883b93f
commit 833fc273a7

View File

@ -171,14 +171,16 @@ impl<T: ?Sized> RwLock<T> {
RwLockReadGuard::new(&*self.inner, &self.data) RwLockReadGuard::new(&*self.inner, &self.data)
} }
/// Attempts to acquire this lock with shared read access. /// Attempts to acquire this rwlock with shared read access.
/// ///
/// This function will never block and will return immediately if `read` /// If the access could not be granted at this time, then `Err` is returned.
/// would otherwise succeed. Returns `Some` of an RAII guard which will /// Otherwise, an RAII guard is returned which will release the shared access
/// release the shared access of this thread when dropped, or `None` if the /// when it is dropped.
/// access could not be granted. This method does not provide any ///
/// guarantees with respect to the ordering of whether contentious readers /// This function does not block.
/// or writers will acquire the lock first. ///
/// This function does not provide any guarantees with respect to the ordering
/// of whether contentious readers or writers will acquire the lock first.
/// ///
/// # Failure /// # Failure
/// ///
@ -219,9 +221,14 @@ impl<T: ?Sized> RwLock<T> {
/// Attempts to lock this rwlock with exclusive write access. /// Attempts to lock this rwlock with exclusive write access.
/// ///
/// This function does not ever block, and it will return `None` if a call /// If the lock could not be acquired at this time, then `Err` is returned.
/// to `write` would otherwise block. If successful, an RAII guard is /// Otherwise, an RAII guard is returned which will release the lock when
/// returned. /// it is dropped.
///
/// This function does not block.
///
/// This function does not provide any guarantees with respect to the ordering
/// of whether contentious readers or writers will acquire the lock first.
/// ///
/// # Failure /// # Failure
/// ///