diff options
| author | bors <bors@rust-lang.org> | 2014-04-10 15:31:55 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-04-10 15:31:55 -0700 |
| commit | 0156af156d70efd5a3c96d0c5b8fc9bec39a7ae5 (patch) | |
| tree | 7cae8ac126922eee38607c2a0032c85cdad7ba0d /src/libstd/sync | |
| parent | 5bcb76181a3b0df2df5ade348af3a1d29fca795e (diff) | |
| parent | 1f2c18a0afd55bf3a5319d9e3810ec1ac6b3e1bb (diff) | |
| download | rust-0156af156d70efd5a3c96d0c5b8fc9bec39a7ae5.tar.gz rust-0156af156d70efd5a3c96d0c5b8fc9bec39a7ae5.zip | |
auto merge of #13443 : alexcrichton/rust/rollup, r=alexcrichton
Closes #13441 (debuginfo: Fixes and improvements for #12840, #12886, and #13213) Closes #13433 (Remove references to @Trait from a compiler error message) Closes #13430 (Fix outdated lint warning about inner attribute) Closes #13425 (Remove a pile of (mainly) internal `~[]` uses) Closes #13419 (Stop using transmute_mut in RefCell) Closes #13417 (Remove an unnecessary file `src/libnative/io/p`.) Closes #13409 (Closing assorted resolve bugs) Closes #13406 (Generalized the pretty-print entry points to support `-o <file>`.) Closes #13403 (test: Add a test for #7663) Closes #13402 (rustdoc: Prune the paths that do not appear in the index.) Closes #13396 (rustc: Remove absolute rpaths) Closes #13371 (Rename ast::Purity and ast::Impure Function. Closes #7287) Closes #13350 (collections: replace all ~[T] with Vec<T>.)
Diffstat (limited to 'src/libstd/sync')
| -rw-r--r-- | src/libstd/sync/deque.rs | 16 | ||||
| -rw-r--r-- | src/libstd/sync/mpmc_bounded_queue.rs | 12 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/libstd/sync/deque.rs b/src/libstd/sync/deque.rs index d01c89878de..8beadce2160 100644 --- a/src/libstd/sync/deque.rs +++ b/src/libstd/sync/deque.rs @@ -62,6 +62,7 @@ use sync::arc::UnsafeArc; use sync::atomics::{AtomicInt, AtomicPtr, SeqCst}; use unstable::sync::Exclusive; use slice::{OwnedVector, ImmutableVector}; +use vec::Vec; // Once the queue is less than 1/K full, then it will be downsized. Note that // the deque requires that this number be less than 2. @@ -116,14 +117,14 @@ pub enum Stolen<T> { /// will only use this structure when allocating a new buffer or deallocating a /// previous one. pub struct BufferPool<T> { - pool: Exclusive<~[~Buffer<T>]>, + pool: Exclusive<Vec<~Buffer<T>>>, } /// An internal buffer used by the chase-lev deque. This structure is actually /// implemented as a circular buffer, and is used as the intermediate storage of /// the data in the deque. /// -/// This type is implemented with *T instead of ~[T] for two reasons: +/// This type is implemented with *T instead of Vec<T> for two reasons: /// /// 1. There is nothing safe about using this buffer. This easily allows the /// same value to be read twice in to rust, and there is nothing to @@ -132,7 +133,7 @@ pub struct BufferPool<T> { /// destructors for values in this buffer (on drop) because the bounds /// are defined by the deque it's owned by. /// -/// 2. We can certainly avoid bounds checks using *T instead of ~[T], although +/// 2. We can certainly avoid bounds checks using *T instead of Vec<T>, although /// LLVM is probably pretty good at doing this already. struct Buffer<T> { storage: *T, @@ -143,7 +144,7 @@ impl<T: Send> BufferPool<T> { /// Allocates a new buffer pool which in turn can be used to allocate new /// deques. pub fn new() -> BufferPool<T> { - BufferPool { pool: Exclusive::new(~[]) } + BufferPool { pool: Exclusive::new(vec!()) } } /// Allocates a new work-stealing deque which will send/receiving memory to @@ -494,7 +495,7 @@ mod tests { } } }) - }).collect::<~[Thread<()>]>(); + }).collect::<Vec<Thread<()>>>(); while remaining.load(SeqCst) > 0 { match w.pop() { @@ -525,7 +526,7 @@ mod tests { Thread::start(proc() { stampede(w, s, 4, 10000); }) - }).collect::<~[Thread<()>]>(); + }).collect::<Vec<Thread<()>>>(); for thread in threads.move_iter() { thread.join(); @@ -556,7 +557,7 @@ mod tests { } } }) - }).collect::<~[Thread<()>]>(); + }).collect::<Vec<Thread<()>>>(); let mut rng = rand::task_rng(); let mut expected = 0; @@ -658,4 +659,3 @@ mod tests { } } } - diff --git a/src/libstd/sync/mpmc_bounded_queue.rs b/src/libstd/sync/mpmc_bounded_queue.rs index 12c05c0d61c..b392cc8ff9a 100644 --- a/src/libstd/sync/mpmc_bounded_queue.rs +++ b/src/libstd/sync/mpmc_bounded_queue.rs @@ -35,7 +35,7 @@ use num::next_power_of_two; use option::{Option, Some, None}; use sync::arc::UnsafeArc; use sync::atomics::{AtomicUint,Relaxed,Release,Acquire}; -use slice; +use vec::Vec; struct Node<T> { sequence: AtomicUint, @@ -44,7 +44,7 @@ struct Node<T> { struct State<T> { pad0: [u8, ..64], - buffer: ~[Node<T>], + buffer: Vec<Node<T>>, mask: uint, pad1: [u8, ..64], enqueue_pos: AtomicUint, @@ -69,7 +69,7 @@ impl<T: Send> State<T> { } else { capacity }; - let buffer = slice::from_fn(capacity, |i| { + let buffer = Vec::from_fn(capacity, |i| { Node { sequence:AtomicUint::new(i), value: None } }); State{ @@ -88,7 +88,7 @@ impl<T: Send> State<T> { let mask = self.mask; let mut pos = self.enqueue_pos.load(Relaxed); loop { - let node = &mut self.buffer[pos & mask]; + let node = self.buffer.get_mut(pos & mask); let seq = node.sequence.load(Acquire); let diff: int = seq as int - pos as int; @@ -114,7 +114,7 @@ impl<T: Send> State<T> { let mask = self.mask; let mut pos = self.dequeue_pos.load(Relaxed); loop { - let node = &mut self.buffer[pos & mask]; + let node = self.buffer.get_mut(pos & mask); let seq = node.sequence.load(Acquire); let diff: int = seq as int - (pos + 1) as int; if diff == 0 { @@ -186,7 +186,7 @@ mod tests { }); } - let mut completion_rxs = ~[]; + let mut completion_rxs = vec![]; for _ in range(0, nthreads) { let (tx, rx) = channel(); completion_rxs.push(rx); |
