// version.
use std::sync::mpsc::{channel, Sender, Receiver};
-use std::os;
use std::env;
- use std::thread::Thread;
+ use std::thread;
use std::time::Duration;
fn move_out<T>(_x: T) {}
// I *think* it's the same, more or less.
use std::sync::mpsc::{channel, Sender, Receiver};
-use std::os;
use std::env;
- use std::thread::Thread;
+ use std::thread;
use std::time::Duration;
enum request {
// except according to those terms.
use std::sync::mpsc::channel;
-use std::os;
+use std::env;
- use std::thread::Thread;
+ use std::thread;
// This is a simple bench that creates M pairs of tasks. These
// tasks ping-pong back and forth over a pair of streams. This is a
// except according to those terms.
use std::sync::mpsc::channel;
-use std::os;
+use std::env;
- use std::thread::Thread;
+ use std::thread;
// A simple implementation of parfib. One subtree is found in a new
// task and communicated over a oneshot pipe, the other is found
// ignore-pretty very bad with line comments
use std::old_io;
-use std::os;
+use std::env;
use std::simd::f64x2;
use std::sync::Arc;
- use std::thread::Thread;
+ use std::thread;
const ITER: usize = 50;
const LIMIT: f64 = 2.0;
extern crate getopts;
use std::sync::mpsc::{channel, Sender};
-use std::os;
use std::env;
use std::result::Result::{Ok, Err};
- use std::thread::Thread;
+ use std::thread;
use std::time::Duration;
-fn fib(n: int) -> int {
- fn pfib(tx: &Sender<int>, n: int) {
+fn fib(n: isize) -> isize {
+ fn pfib(tx: &Sender<isize>, n: isize) {
if n == 0 {
tx.send(0).unwrap();
} else if n <= 2 {
// ignore-pretty very bad with line comments
use std::sync::mpsc::{channel, Sender};
-use std::os;
use std::env;
- use std::thread::Thread;
+ use std::thread;
fn child_generation(gens_left: uint, tx: Sender<()>) {
// This used to be O(n^2) in the number of generations that ever existed.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::os;
use std::env;
- use std::thread::Thread;
+ use std::thread;
-fn f(n: uint) {
+fn f(n: usize) {
let mut i = 0u;
while i < n {
- let _ = Thread::scoped(move|| g()).join();
+ let _ = thread::spawn(move|| g()).join();
i += 1u;
}
}
fn g() { }
fn main() {
- let args = os::args();
+ let args = env::args();
let args = if env::var_os("RUST_BENCH").is_some() {
vec!("".to_string(), "400".to_string())
- } else if args.len() <= 1u {
+ } else if args.len() <= 1 {
vec!("".to_string(), "10".to_string())
} else {
- args.into_iter().collect()
+ args.collect()
};
let n = args[1].parse().unwrap();
- let mut i = 0u;
- while i < n { thread::spawn(move|| f(n) ); i += 1u; }
+ let mut i = 0;
- while i < n { Thread::spawn(move|| f(n) ); i += 1u; }
++ while i < n { thread::spawn(move|| f(n) ); i += 1; }
}