summaryrefslogtreecommitdiff
path: root/test/bench/threadring.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-12-15 15:41:46 -0800
committerRobert Griesemer <gri@golang.org>2009-12-15 15:41:46 -0800
commit3743fa38e180c74c51aae84eda082067e8e12523 (patch)
tree274d1d9bf832b7834ab60c65acdf945576271d14 /test/bench/threadring.go
parent13ac778ef2f757c7cd636b4336a2bd6c8f403b43 (diff)
downloadgolang-3743fa38e180c74c51aae84eda082067e8e12523.tar.gz
1) Change default gofmt default settings for
parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 5th and last set of files. R=rsc CC=golang-dev http://codereview.appspot.com/180050
Diffstat (limited to 'test/bench/threadring.go')
-rw-r--r--test/bench/threadring.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/test/bench/threadring.go b/test/bench/threadring.go
index c069a2655..031908a20 100644
--- a/test/bench/threadring.go
+++ b/test/bench/threadring.go
@@ -36,9 +36,9 @@ POSSIBILITY OF SUCH DAMAGE.
package main
import (
- "flag";
- "fmt";
- "os";
+ "flag"
+ "fmt"
+ "os"
)
var n = flag.Int("n", 1000, "how many passes")
@@ -47,25 +47,25 @@ const Nthread = 503
func f(i int, in <-chan int, out chan<- int) {
for {
- n := <-in;
+ n := <-in
if n == 0 {
- fmt.Printf("%d\n", i);
- os.Exit(0);
+ fmt.Printf("%d\n", i)
+ os.Exit(0)
}
- out <- n-1;
+ out <- n-1
}
}
func main() {
- flag.Parse();
+ flag.Parse()
- one := make(chan int); // will be input to thread 1
- var in, out chan int = nil, one;
+ one := make(chan int) // will be input to thread 1
+ var in, out chan int = nil, one
for i := 1; i <= Nthread-1; i++ {
- in, out = out, make(chan int);
- go f(i, in, out);
+ in, out = out, make(chan int)
+ go f(i, in, out)
}
- go f(Nthread, out, one);
- one <- *n;
- <-make(chan int); // hang until ring completes
+ go f(Nthread, out, one)
+ one <- *n
+ <-make(chan int) // hang until ring completes
}