You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
387 B
22 lines
387 B
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
func hello(done chan bool) {
|
|
fmt.Println("hello go routine is going to sleep")
|
|
time.Sleep(4 * time.Second)
|
|
fmt.Println("hello go routine awake and going to write to done")
|
|
done <- true
|
|
}
|
|
|
|
func main() {
|
|
done := make(chan bool)
|
|
fmt.Println("Main going to call hello go goroutine")
|
|
go hello(done)
|
|
<-done
|
|
fmt.Println("Main received data")
|
|
}
|