mirror of https://github.com/golang/go.git
change command-line argument to be
unnamed, not require -n, in line with other entries. R=rsc CC=r https://golang.org/cl/162061
This commit is contained in:
parent
842d69b03d
commit
99d0c3d85d
|
|
@ -35,8 +35,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
import "flag"
|
"flag";
|
||||||
|
"fmt";
|
||||||
|
"strconv";
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
blue = iota;
|
blue = iota;
|
||||||
|
|
@ -85,12 +88,13 @@ type result struct {
|
||||||
same int;
|
same int;
|
||||||
}
|
}
|
||||||
|
|
||||||
var np = flag.Int("n", 600, "count")
|
var n = 600
|
||||||
var N int
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse();
|
flag.Parse();
|
||||||
N = *np;
|
if flag.NArg() > 0 {
|
||||||
|
n, _ = strconv.Atoi(flag.Arg(0))
|
||||||
|
}
|
||||||
|
|
||||||
for c0 := 0; c0 < ncol; c0++ {
|
for c0 := 0; c0 < ncol; c0++ {
|
||||||
for c1 := 0; c1 < ncol; c1++ {
|
for c1 := 0; c1 < ncol; c1++ {
|
||||||
|
|
@ -137,8 +141,8 @@ func creature(info0 info, meetingplace chan rendez, ended chan result) {
|
||||||
var othername int;
|
var othername int;
|
||||||
// get access to rendez data and decide what to do.
|
// get access to rendez data and decide what to do.
|
||||||
switch r := <-meetingplace; {
|
switch r := <-meetingplace; {
|
||||||
case r.n >= N:
|
case r.n >= n:
|
||||||
// if more than N meetings, then send our result data and exit.
|
// if no more meetings left, then send our result data and exit.
|
||||||
meetingplace <- rendez{n: r.n};
|
meetingplace <- rendez{n: r.n};
|
||||||
ended <- result{met, same};
|
ended <- result{met, same};
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -176,8 +176,8 @@ threadring() {
|
||||||
chameneos() {
|
chameneos() {
|
||||||
runonly echo 'chameneos 6000000'
|
runonly echo 'chameneos 6000000'
|
||||||
run 'gcc -O2 chameneosredux.c -lpthread' a.out 6000000
|
run 'gcc -O2 chameneosredux.c -lpthread' a.out 6000000
|
||||||
# run 'gccgo -O2 chameneosredux.go' a.out -n 6000000 # doesn't support the non-forward-decl variant
|
# run 'gccgo -O2 chameneosredux.go' a.out 6000000 # doesn't support the non-forward-decl variant
|
||||||
run 'gc chameneosredux' $O.out -n 6000000
|
run 'gc chameneosredux' $O.out 6000000
|
||||||
}
|
}
|
||||||
|
|
||||||
case $# in
|
case $# in
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue