Ignore:
Timestamp:
Jan 9, 2020, 5:06:29 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
51493a4, 6b6a3b8
Parents:
c93fd72
Message:

change Go command-line code to behave like C

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/ctxswitch/goroutine.go

    rc93fd72 r50cfa99  
    22
    33import (
    4     "fmt"
    5     "time"
    6     "flag"
    7     "runtime"
     4        "fmt"
     5        "time"
     6        "os"
     7        "strconv"
     8        "runtime"
    89)
    910
     
    2930
    3031func main() {
    31         times := flag.Int( "times", 10000000, "loop iterations" )
    32         go ContextSwitch( *times )              // context switch
     32        var times int = 10000000
     33        if len( os.Args ) > 2 { os.Exit( 1 ) }
     34        if len( os.Args ) == 2 { times, _ = strconv.Atoi(os.Args[1]) }
     35        go ContextSwitch( times )               // context switch
    3336        <- shake
    3437}
Note: See TracChangeset for help on using the changeset viewer.