about summary refs log tree commit diff
path: root/src/test/bench/shootout-reverse-complement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/bench/shootout-reverse-complement.rs')
-rw-r--r--src/test/bench/shootout-reverse-complement.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs
index 909f8afc34a..d9dfd65d5b3 100644
--- a/src/test/bench/shootout-reverse-complement.rs
+++ b/src/test/bench/shootout-reverse-complement.rs
@@ -45,9 +45,10 @@
 extern crate libc;
 
 use std::io::stdio::{stdin_raw, stdout_raw};
+use std::io::{IoResult, EndOfFile};
 use std::num::{div_rem};
 use std::ptr::{copy_memory, Unique};
-use std::io::{IoResult, EndOfFile};
+use std::thread::Thread;
 
 struct Tables {
     table8: [u8;1 << 8],
@@ -229,26 +230,20 @@ unsafe impl<T: 'static> Send for Racy<T> {}
 fn parallel<'a, I, T, F>(mut iter: I, f: F)
         where T: 'a+Send + Sync,
               I: Iterator<&'a mut [T]>,
-              F: Fn(&'a mut [T]) + Sync {
+              F: Fn(&mut [T]) + Sync {
     use std::mem;
     use std::raw::Repr;
 
-    let (tx, rx) = channel();
-    for chunk in iter {
-        let tx = tx.clone();
-
+    iter.map(|chunk| {
         // Need to convert `f` and `chunk` to something that can cross the task
         // boundary.
         let f = Racy(&f as *const F as *const uint);
         let raw = Racy(chunk.repr());
-        spawn(move|| {
+        Thread::spawn(move|| {
             let f = f.0 as *const F;
             unsafe { (*f)(mem::transmute(raw.0)) }
-            drop(tx)
-        });
-    }
-    drop(tx);
-    for () in rx.iter() {}
+        })
+    }).collect::<Vec<_>>();
 }
 
 fn main() {