diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-19 17:50:57 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-19 17:50:57 -0700 |
| commit | 73729e94c87281dd7193dbdc86b4de2963b8fd72 (patch) | |
| tree | 9bc042e0c8201095faa0c34b792072b55ddc5b65 /src/libstd/sync/mpsc_queue.rs | |
| parent | d49aef7c024dba42fe9e440c06065235fa8a73f7 (diff) | |
| download | rust-73729e94c87281dd7193dbdc86b4de2963b8fd72.tar.gz rust-73729e94c87281dd7193dbdc86b4de2963b8fd72.zip | |
std: Move comm primitives away from UnsafeArc
They currently still use `&mut self`, this migration was aimed towards moving from UnsafeArc<T> to Arc<Unsafe<T>>
Diffstat (limited to 'src/libstd/sync/mpsc_queue.rs')
| -rw-r--r-- | src/libstd/sync/mpsc_queue.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libstd/sync/mpsc_queue.rs b/src/libstd/sync/mpsc_queue.rs index 23afb9487ec..f2f95da1842 100644 --- a/src/libstd/sync/mpsc_queue.rs +++ b/src/libstd/sync/mpsc_queue.rs @@ -158,9 +158,10 @@ impl<T: Send> Drop for Queue<T> { mod tests { use prelude::*; + use alloc::arc::Arc; + use native; use super::{Queue, Data, Empty, Inconsistent}; - use sync::arc::UnsafeArc; #[test] fn test_full() { @@ -179,14 +180,14 @@ mod tests { Inconsistent | Data(..) => fail!() } let (tx, rx) = channel(); - let q = UnsafeArc::new(q); + let q = Arc::new(q); for _ in range(0, nthreads) { let tx = tx.clone(); let q = q.clone(); native::task::spawn(proc() { for i in range(0, nmsgs) { - unsafe { (*q.get()).push(i); } + q.push(i); } tx.send(()); }); @@ -194,7 +195,7 @@ mod tests { let mut i = 0u; while i < nthreads * nmsgs { - match unsafe { (*q.get()).pop() } { + match q.pop() { Empty | Inconsistent => {}, Data(_) => { i += 1 } } |
