blob: cc496c11656cbb28569b2cfbd057a1058e0419b6 [file] [log] [blame]
// +build ignore,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