awesome-patterns/concurrency/concurrency_in_go/ch3/main.go

22 lines
250 B
Go
Raw Normal View History

2018-01-12 07:27:12 +03:00
package main
import (
"fmt"
"time"
)
// demostration of channel and timeout
func main() {
ourChan := make(chan string, 1)
go func() {
}()
select {
case <-time.After(10 * time.Second):
fmt.Println("Enough waiting")
close(ourChan)
}
}