Created
September 27, 2018 19:17
-
-
Save comtom/1868dbe8f23c5d5e8007e6e9f64b57fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func worker(done chan bool) { | |
| fmt.Print("working...") | |
| time.Sleep(time.Second) | |
| fmt.Println("done") | |
| done <- true | |
| } | |
| func main() { | |
| done := make(chan bool, 1) | |
| go worker(done) | |
| <-done | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment