about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorSeo Sanghyeon <sanxiyn@gmail.com>2016-11-26 22:02:15 +0900
committerGitHub <noreply@github.com>2016-11-26 22:02:15 +0900
commit44b926a6bbe3b8a48d077a72126b5921f87ece65 (patch)
tree3b3caa455cb653f39433ae8f0a1c2f4ff8ebddbe /src/libstd/sync
parentf9f92e12c7cd00da8b5642e68025a7e833e5b9cb (diff)
parent6075af4ac0b031f738da624ee0e9962f25f57e4c (diff)
downloadrust-44b926a6bbe3b8a48d077a72126b5921f87ece65.tar.gz
rust-44b926a6bbe3b8a48d077a72126b5921f87ece65.zip
Rollup merge of #38010 - frewsxcv:lock-creations, r=GuillaumeGomez
Document how lock 'guard' structures are created.
Diffstat (limited to 'src/libstd/sync')
-rw-r--r--src/libstd/sync/mutex.rs9
-rw-r--r--src/libstd/sync/rwlock.rs14
2 files changed, 22 insertions, 1 deletions
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs
index 812724c7a16..df4a3746a49 100644
--- a/src/libstd/sync/mutex.rs
+++ b/src/libstd/sync/mutex.rs
@@ -133,7 +133,14 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> { }
 /// dropped (falls out of scope), the lock will be unlocked.
 ///
 /// The data protected by the mutex can be access through this guard via its
-/// `Deref` and `DerefMut` implementations
+/// `Deref` and `DerefMut` implementations.
+///
+/// This structure is created by the [`lock()`] and [`try_lock()`] methods on
+/// [`Mutex`].
+///
+/// [`lock()`]: struct.Mutex.html#method.lock
+/// [`try_lock()`]: struct.Mutex.html#method.try_lock
+/// [`Mutex`]: struct.Mutex.html
 #[must_use]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct MutexGuard<'a, T: ?Sized + 'a> {
diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs
index f08b7641521..f83cf7ba9c2 100644
--- a/src/libstd/sync/rwlock.rs
+++ b/src/libstd/sync/rwlock.rs
@@ -77,6 +77,13 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
 
 /// RAII structure used to release the shared read access of a lock when
 /// dropped.
+///
+/// This structure is created by the [`read()`] and [`try_read()`] methods on
+/// [`RwLock`].
+///
+/// [`read()`]: struct.RwLock.html#method.read
+/// [`try_read()`]: struct.RwLock.html#method.try_read
+/// [`RwLock`]: struct.RwLock.html
 #[must_use]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct RwLockReadGuard<'a, T: ?Sized + 'a> {
@@ -88,6 +95,13 @@ impl<'a, T: ?Sized> !marker::Send for RwLockReadGuard<'a, T> {}
 
 /// RAII structure used to release the exclusive write access of a lock when
 /// dropped.
+///
+/// This structure is created by the [`write()`] and [`try_write()`] methods
+/// on [`RwLock`].
+///
+/// [`write()`]: struct.RwLock.html#method.write
+/// [`try_write()`]: struct.RwLock.html#method.try_write
+/// [`RwLock`]: struct.RwLock.html
 #[must_use]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct RwLockWriteGuard<'a, T: ?Sized + 'a> {