about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2015-04-30 22:30:50 +1200
committerNick Cameron <ncameron@mozilla.com>2015-04-30 22:30:50 +1200
commitb2ddd937b20d8fc26132cb7ec665784422d92926 (patch)
treecf257df60ded1b45616d797b8feb71178cab0142 /src/libstd/sync
parentc0a42aecbc85298fb6351253c4cd1824567b7a42 (diff)
parentf0bd14f7b15b978f8bf32bb368f63faa0f26c02e (diff)
downloadrust-b2ddd937b20d8fc26132cb7ec665784422d92926.tar.gz
rust-b2ddd937b20d8fc26132cb7ec665784422d92926.zip
Merge branch 'master' into mulit-decor
Diffstat (limited to 'src/libstd/sync')
-rw-r--r--src/libstd/sync/future.rs2
-rw-r--r--src/libstd/sync/mpsc/mod.rs5
-rw-r--r--src/libstd/sync/mpsc/mpsc_queue.rs1
-rw-r--r--src/libstd/sync/mpsc/oneshot.rs1
-rw-r--r--src/libstd/sync/mpsc/select.rs4
-rw-r--r--src/libstd/sync/mpsc/shared.rs1
-rw-r--r--src/libstd/sync/mpsc/spsc_queue.rs3
-rw-r--r--src/libstd/sync/mpsc/stream.rs1
-rw-r--r--src/libstd/sync/mpsc/sync.rs1
-rw-r--r--src/libstd/sync/mutex.rs4
-rw-r--r--src/libstd/sync/once.rs8
-rw-r--r--src/libstd/sync/rwlock.rs3
-rw-r--r--src/libstd/sync/semaphore.rs1
13 files changed, 11 insertions, 24 deletions
diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs
index 2cdde1aca9e..2d281eb4e24 100644
--- a/src/libstd/sync/future.rs
+++ b/src/libstd/sync/future.rs
@@ -155,7 +155,7 @@ impl<A:Send+'static> Future<A> {
 }
 
 #[cfg(test)]
-mod test {
+mod tests {
     use prelude::v1::*;
     use sync::mpsc::channel;
     use sync::Future;
diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs
index b3cc133d229..61932225d79 100644
--- a/src/libstd/sync/mpsc/mod.rs
+++ b/src/libstd/sync/mpsc/mod.rs
@@ -619,7 +619,6 @@ impl<T> Clone for Sender<T> {
     }
 }
 
-#[unsafe_destructor]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> Drop for Sender<T> {
     fn drop(&mut self) {
@@ -683,7 +682,6 @@ impl<T> Clone for SyncSender<T> {
     }
 }
 
-#[unsafe_destructor]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> Drop for SyncSender<T> {
     fn drop(&mut self) {
@@ -930,7 +928,6 @@ impl <T> IntoIterator for Receiver<T> {
     }
 }
 
-#[unsafe_destructor]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> Drop for Receiver<T> {
     fn drop(&mut self) {
@@ -1065,7 +1062,7 @@ impl error::Error for TryRecvError {
 }
 
 #[cfg(test)]
-mod test {
+mod tests {
     use prelude::v1::*;
 
     use std::env;
diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs
index 9b6c8f4dd97..4ab5a796fcb 100644
--- a/src/libstd/sync/mpsc/mpsc_queue.rs
+++ b/src/libstd/sync/mpsc/mpsc_queue.rs
@@ -138,7 +138,6 @@ impl<T> Queue<T> {
     }
 }
 
-#[unsafe_destructor]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> Drop for Queue<T> {
     fn drop(&mut self) {
diff --git a/src/libstd/sync/mpsc/oneshot.rs b/src/libstd/sync/mpsc/oneshot.rs
index c6e8d87a22e..ab45b722c45 100644
--- a/src/libstd/sync/mpsc/oneshot.rs
+++ b/src/libstd/sync/mpsc/oneshot.rs
@@ -367,7 +367,6 @@ impl<T> Packet<T> {
     }
 }
 
-#[unsafe_destructor]
 impl<T> Drop for Packet<T> {
     fn drop(&mut self) {
         assert_eq!(self.state.load(Ordering::SeqCst), DISCONNECTED);
diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs
index b8ad92841f2..fde99e11040 100644
--- a/src/libstd/sync/mpsc/select.rs
+++ b/src/libstd/sync/mpsc/select.rs
@@ -315,7 +315,6 @@ impl<'rx, T: Send> Handle<'rx, T> {
     }
 }
 
-#[unsafe_destructor]
 impl Drop for Select {
     fn drop(&mut self) {
         assert!(self.head.is_null());
@@ -323,7 +322,6 @@ impl Drop for Select {
     }
 }
 
-#[unsafe_destructor]
 impl<'rx, T: Send> Drop for Handle<'rx, T> {
     fn drop(&mut self) {
         unsafe { self.remove() }
@@ -346,7 +344,7 @@ impl Iterator for Packets {
 
 #[cfg(test)]
 #[allow(unused_imports)]
-mod test {
+mod tests {
     use prelude::v1::*;
 
     use thread;
diff --git a/src/libstd/sync/mpsc/shared.rs b/src/libstd/sync/mpsc/shared.rs
index 5c1610bdc31..09a02923f14 100644
--- a/src/libstd/sync/mpsc/shared.rs
+++ b/src/libstd/sync/mpsc/shared.rs
@@ -473,7 +473,6 @@ impl<T> Packet<T> {
     }
 }
 
-#[unsafe_destructor]
 impl<T> Drop for Packet<T> {
     fn drop(&mut self) {
         // Note that this load is not only an assert for correctness about
diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs
index c75ac130808..f4b9c7d45fd 100644
--- a/src/libstd/sync/mpsc/spsc_queue.rs
+++ b/src/libstd/sync/mpsc/spsc_queue.rs
@@ -226,7 +226,6 @@ impl<T> Queue<T> {
     }
 }
 
-#[unsafe_destructor]
 impl<T> Drop for Queue<T> {
     fn drop(&mut self) {
         unsafe {
@@ -241,7 +240,7 @@ impl<T> Drop for Queue<T> {
 }
 
 #[cfg(test)]
-mod test {
+mod tests {
     use prelude::v1::*;
 
     use sync::Arc;
diff --git a/src/libstd/sync/mpsc/stream.rs b/src/libstd/sync/mpsc/stream.rs
index f0363fae84f..1200e71d9af 100644
--- a/src/libstd/sync/mpsc/stream.rs
+++ b/src/libstd/sync/mpsc/stream.rs
@@ -471,7 +471,6 @@ impl<T> Packet<T> {
     }
 }
 
-#[unsafe_destructor]
 impl<T> Drop for Packet<T> {
     fn drop(&mut self) {
         // Note that this load is not only an assert for correctness about
diff --git a/src/libstd/sync/mpsc/sync.rs b/src/libstd/sync/mpsc/sync.rs
index 6221ca59b54..4687df107f6 100644
--- a/src/libstd/sync/mpsc/sync.rs
+++ b/src/libstd/sync/mpsc/sync.rs
@@ -411,7 +411,6 @@ impl<T> Packet<T> {
     }
 }
 
-#[unsafe_destructor]
 impl<T> Drop for Packet<T> {
     fn drop(&mut self) {
         assert_eq!(self.channels.load(Ordering::SeqCst), 0);
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs
index 5e688717c4a..30c7407a96d 100644
--- a/src/libstd/sync/mutex.rs
+++ b/src/libstd/sync/mutex.rs
@@ -244,7 +244,6 @@ impl<T> Mutex<T> {
     }
 }
 
-#[unsafe_destructor]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> Drop for Mutex<T> {
     fn drop(&mut self) {
@@ -340,7 +339,6 @@ impl<'mutex, T> DerefMut for MutexGuard<'mutex, T> {
     }
 }
 
-#[unsafe_destructor]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> Drop for MutexGuard<'a, T> {
     #[inline]
@@ -361,7 +359,7 @@ pub fn guard_poison<'a, T>(guard: &MutexGuard<'a, T>) -> &'a poison::Flag {
 }
 
 #[cfg(test)]
-mod test {
+mod tests {
     use prelude::v1::*;
 
     use sync::mpsc::channel;
diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs
index 948965f5efa..2d712369228 100644
--- a/src/libstd/sync/once.rs
+++ b/src/libstd/sync/once.rs
@@ -59,7 +59,11 @@ impl Once {
     /// routine is currently running.
     ///
     /// When this function returns, it is guaranteed that some initialization
-    /// has run and completed (it may not be the closure specified).
+    /// has run and completed (it may not be the closure specified). It is also
+    /// guaranteed that any memory writes performed by the executed closure can
+    /// be reliably observed by other tasks at this point (there is a
+    /// happens-before relation between the closure and code executing after the
+    /// return).
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn call_once<F>(&'static self, f: F) where F: FnOnce() {
         // Optimize common path: load is much cheaper than fetch_add.
@@ -121,7 +125,7 @@ impl Once {
 }
 
 #[cfg(test)]
-mod test {
+mod tests {
     use prelude::v1::*;
 
     use thread;
diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs
index 1ea92d5eff7..a133bb01b61 100644
--- a/src/libstd/sync/rwlock.rs
+++ b/src/libstd/sync/rwlock.rs
@@ -249,7 +249,6 @@ impl<T> RwLock<T> {
     }
 }
 
-#[unsafe_destructor]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> Drop for RwLock<T> {
     fn drop(&mut self) {
@@ -387,7 +386,6 @@ impl<'rwlock, T> DerefMut for RwLockWriteGuard<'rwlock, T> {
     }
 }
 
-#[unsafe_destructor]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> Drop for RwLockReadGuard<'a, T> {
     fn drop(&mut self) {
@@ -395,7 +393,6 @@ impl<'a, T> Drop for RwLockReadGuard<'a, T> {
     }
 }
 
-#[unsafe_destructor]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> Drop for RwLockWriteGuard<'a, T> {
     fn drop(&mut self) {
diff --git a/src/libstd/sync/semaphore.rs b/src/libstd/sync/semaphore.rs
index be521095aa9..776b3c5064c 100644
--- a/src/libstd/sync/semaphore.rs
+++ b/src/libstd/sync/semaphore.rs
@@ -100,7 +100,6 @@ impl Semaphore {
     }
 }
 
-#[unsafe_destructor]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Drop for SemaphoreGuard<'a> {
     fn drop(&mut self) {