wat
This commit is contained in:
parent
098a71ef89
commit
7854ae3cdf
18
41-synchronization.go
Normal file
18
41-synchronization.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
func printer(done chan<- bool) {
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
time.Sleep(time.Millisecond * 100)
|
||||||
|
fmt.Println(i)
|
||||||
|
}
|
||||||
|
done <- true
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
done := make(chan bool, 1)
|
||||||
|
go printer(done)
|
||||||
|
<- done
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user