blob: 6c054524b2a6d6886701994d18ca18fe4418caf3 [file] [log] [blame]
// +build OMIT
package main
import (
"fmt"
"time"
)
// f START OMIT
func f(msg string, delay time.Duration, ch chan string) {
for {
ch <- msg
time.Sleep(delay)
}
}
// f END OMIT
// main START OMIT
func main() {
ch := make(chan string)
go f("A--", 300*time.Millisecond, ch)
go f("-B-", 500*time.Millisecond, ch)
go f("--C", 1100*time.Millisecond, ch)
for i := 0; i < 100; i++ {
fmt.Println(i, <-ch)
}
}
// main END OMIT