This commit is contained in:
Mark McGranaghan 2012-09-23 04:17:40 -04:00
parent 5b7c5e7f3f
commit e9b82fac25
5 changed files with 13 additions and 10 deletions

View File

@ -11,3 +11,6 @@ func main() {
fmt.Println("====== Output") fmt.Println("====== Output")
fmt.Print(string(out)) fmt.Print(string(out))
} }
// == todo
// full command lines with bash?

View File

@ -9,7 +9,7 @@ func main() {
fmt.Println("Tick at", t) fmt.Println("Tick at", t)
} }
}() }()
time.Sleep(time.Millisecond * 3000) time.Sleep(time.Millisecond * 1500)
ticker.Stop() ticker.Stop()
fmt.Println("Ticker stopped") fmt.Println("Ticker stopped")
} }

View File

@ -1,20 +1,20 @@
package main package main
import ("time"; "fmt") import "time"
import "fmt"
func main() { func main() {
timer1 := time.NewTimer(time.Millisecond * 500) timer1 := time.NewTimer(time.Second)
<- timer1.C <- timer1.C
fmt.Println("Timer 1 expired") fmt.Println("Timer 1 expired")
stopped1 := timer1.Stop() stop1 := timer1.Stop()
fmt.Println("Timer 2 stopped:", stopped1) fmt.Println("Timer 2 stopped:", stop1)
timer2 := time.NewTimer(time.Second) timer2 := time.NewTimer(time.Second)
go func() { go func() {
<- timer2.C <- timer2.C
fmt.Println("Timer 2 expired") fmt.Println("Timer 2 expired")
}() }()
time.Sleep(time.Millisecond * 500) stop2 := timer2.Stop()
stopped2 := timer2.Stop() fmt.Println("Timer 2 stopped:", stop2)
fmt.Println("Timer 2 stopped:", stopped2)
} }

View File

@ -82,7 +82,7 @@ scatter-gather
sha1 sha1
signals signals
sort sort
sortby sort-by-function
spawn spawn
string-formatting string-formatting
tcp-client tcp-client
@ -92,4 +92,4 @@ time
timers timers
url url
users users
worker-pool worker-pool