about summary refs log tree commit diff
path: root/src/libstd/sync/rwlock.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2015-01-24 09:15:42 -0800
committerBrian Anderson <banderson@mozilla.com>2015-01-25 01:20:55 -0800
commit63fcbcf3ce8f0ca391c18b2d61833ae6beb3ac70 (patch)
treec732033c0822f25f2aebcdf193de1b257bac1855 /src/libstd/sync/rwlock.rs
parentb44ee371b8beea77aa1364460acbba14a8516559 (diff)
parent0430a43d635841db44978bb648e9cf7e7cfa1bba (diff)
downloadrust-63fcbcf3ce8f0ca391c18b2d61833ae6beb3ac70.tar.gz
rust-63fcbcf3ce8f0ca391c18b2d61833ae6beb3ac70.zip
Merge remote-tracking branch 'rust-lang/master'
Conflicts:
	mk/tests.mk
	src/liballoc/arc.rs
	src/liballoc/boxed.rs
	src/liballoc/rc.rs
	src/libcollections/bit.rs
	src/libcollections/btree/map.rs
	src/libcollections/btree/set.rs
	src/libcollections/dlist.rs
	src/libcollections/ring_buf.rs
	src/libcollections/slice.rs
	src/libcollections/str.rs
	src/libcollections/string.rs
	src/libcollections/vec.rs
	src/libcollections/vec_map.rs
	src/libcore/any.rs
	src/libcore/array.rs
	src/libcore/borrow.rs
	src/libcore/error.rs
	src/libcore/fmt/mod.rs
	src/libcore/iter.rs
	src/libcore/marker.rs
	src/libcore/ops.rs
	src/libcore/result.rs
	src/libcore/slice.rs
	src/libcore/str/mod.rs
	src/libregex/lib.rs
	src/libregex/re.rs
	src/librustc/lint/builtin.rs
	src/libstd/collections/hash/map.rs
	src/libstd/collections/hash/set.rs
	src/libstd/sync/mpsc/mod.rs
	src/libstd/sync/mutex.rs
	src/libstd/sync/poison.rs
	src/libstd/sync/rwlock.rs
	src/libsyntax/feature_gate.rs
	src/libsyntax/test.rs
Diffstat (limited to 'src/libstd/sync/rwlock.rs')
-rw-r--r--src/libstd/sync/rwlock.rs62
1 files changed, 9 insertions, 53 deletions
diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs
index 01389047df6..12befbf72e3 100644
--- a/src/libstd/sync/rwlock.rs
+++ b/src/libstd/sync/rwlock.rs
@@ -112,54 +112,35 @@ pub const RW_LOCK_INIT: StaticRwLock = StaticRwLock {
 /// dropped.
 #[must_use]
 #[stable(feature = "rust1", since = "1.0.0")]
-#[cfg(stage0)] // NOTE remove impl after next snapshot
 pub struct RwLockReadGuard<'a, T: 'a> {
     __lock: &'a StaticRwLock,
     __data: &'a UnsafeCell<T>,
-    __marker: marker::NoSend,
 }
 
-/// RAII structure used to release the shared read access of a lock when
-/// dropped.
-#[must_use]
-#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
-#[stable(feature = "rust1", since = "1.0.0")]
-pub struct RwLockReadGuard<'a, T: 'a> {
-    __lock: &'a StaticRwLock,
-    __data: &'a UnsafeCell<T>,
-}
-
-#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
 impl<'a, T> !marker::Send for RwLockReadGuard<'a, T> {}
 
 /// RAII structure used to release the exclusive write access of a lock when
 /// dropped.
 #[must_use]
-#[cfg(stage0)] // NOTE remove impl after next snapshot
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct RwLockWriteGuard<'a, T: 'a> {
     __lock: &'a StaticRwLock,
     __data: &'a UnsafeCell<T>,
     __poison: poison::Guard,
-    __marker: marker::NoSend,
 }
 
-/// RAII structure used to release the exclusive write access of a lock when
-/// dropped.
-#[must_use]
-#[stable(feature = "rust1", since = "1.0.0")]
-#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
-pub struct RwLockWriteGuard<'a, T: 'a> {
-    __lock: &'a StaticRwLock,
-    __data: &'a UnsafeCell<T>,
-    __poison: poison::Guard,
-}
-
-#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
 impl<'a, T> !marker::Send for RwLockWriteGuard<'a, T> {}
 
 impl<T: Send + Sync> RwLock<T> {
-    /// Creates a new instance of an RwLock which is unlocked and read to go.
+    /// Creates a new instance of an `RwLock<T>` which is unlocked.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::sync::RwLock;
+    ///
+    /// let lock = RwLock::new(5);
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn new(t: T) -> RwLock<T> {
         RwLock { inner: box RW_LOCK_INIT, data: UnsafeCell::new(t) }
@@ -339,19 +320,7 @@ impl StaticRwLock {
 }
 
 impl<'rwlock, T> RwLockReadGuard<'rwlock, T> {
-    #[cfg(stage0)] // NOTE remove impl after next snapshot
-    fn new(lock: &'rwlock StaticRwLock, data: &'rwlock UnsafeCell<T>)
-           -> LockResult<RwLockReadGuard<'rwlock, T>> {
-        poison::map_result(lock.poison.borrow(), |_| {
-            RwLockReadGuard {
-                __lock: lock,
-                __data: data,
-                __marker: marker::NoSend,
-            }
-        })
-    }
 
-    #[cfg(not(stage0))] // NOTE remove cfg after next snapshot
     fn new(lock: &'rwlock StaticRwLock, data: &'rwlock UnsafeCell<T>)
            -> LockResult<RwLockReadGuard<'rwlock, T>> {
         poison::map_result(lock.poison.borrow(), |_| {
@@ -363,20 +332,7 @@ impl<'rwlock, T> RwLockReadGuard<'rwlock, T> {
     }
 }
 impl<'rwlock, T> RwLockWriteGuard<'rwlock, T> {
-    #[cfg(stage0)] // NOTE remove impl after next snapshot
-    fn new(lock: &'rwlock StaticRwLock, data: &'rwlock UnsafeCell<T>)
-           -> LockResult<RwLockWriteGuard<'rwlock, T>> {
-        poison::map_result(lock.poison.borrow(), |guard| {
-            RwLockWriteGuard {
-                __lock: lock,
-                __data: data,
-                __poison: guard,
-                __marker: marker::NoSend,
-            }
-        })
-    }
 
-    #[cfg(not(stage0))] // NOTE remove cfg after next snapshot
     fn new(lock: &'rwlock StaticRwLock, data: &'rwlock UnsafeCell<T>)
            -> LockResult<RwLockWriteGuard<'rwlock, T>> {
         poison::map_result(lock.poison.borrow(), |guard| {