diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-12-13 12:46:31 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-12-14 14:59:32 -0800 |
| commit | dff2853e4de3a7d2e69c6acfbf8c952026fe99aa (patch) | |
| tree | b77b7d58be47877bbe9d1127b09d570047862fef /src | |
| parent | 05a35a2e5c0b342cd48ce91c244d4570aa30e658 (diff) | |
| download | rust-dff2853e4de3a7d2e69c6acfbf8c952026fe99aa.tar.gz rust-dff2853e4de3a7d2e69c6acfbf8c952026fe99aa.zip | |
Remove bench/shootout-threadring.rs
Will need to be completely rewritten for pipes
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/bench/shootout-threadring.rs | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/test/bench/shootout-threadring.rs b/src/test/bench/shootout-threadring.rs deleted file mode 100644 index 40e05ec39b7..00000000000 --- a/src/test/bench/shootout-threadring.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Based on threadring.erlang by Jira Isa -extern mod std; - -const n_threads: int = 503; - -fn start(+token: int) { - use iter::*; - - let p = comm::Port(); - let mut ch = comm::Chan(&p); - for int::range(2, n_threads + 1) |i| { - let id = n_threads + 2 - i; - let to_child = do task::spawn_listener::<int> |p, copy ch| { - roundtrip(id, p, ch) - }; - ch = to_child; - } - comm::send(ch, token); - roundtrip(1, p, ch); -} - -fn roundtrip(id: int, p: comm::Port<int>, ch: comm::Chan<int>) { - while (true) { - match comm::recv(p) { - 1 => { - io::println(fmt!("%d\n", id)); - return; - } - token => { - debug!("%d %d", id, token); - comm::send(ch, token - 1); - if token <= n_threads { - return; - } - } - } - } -} - -fn main() { - let args = os::args(); - let args = if os::getenv(~"RUST_BENCH").is_some() { - ~[~"", ~"2000000"] - } else if args.len() <= 1u { - ~[~"", ~"1000"] - } else { - args - }; - - let token = int::from_str(args[1]).get(); - - start(token); -} |
