_examples/goroutine.go: simpler shutdown logic

This commit is contained in:
Harmen 2016-12-18 20:39:02 +01:00 committed by Roi Martin
parent 7ac95c981b
commit c690b943b6
1 changed files with 2 additions and 4 deletions

View File

@ -16,7 +16,7 @@ import (
const NumGoroutines = 10
var (
done = make(chan bool)
done = make(chan struct{})
wg sync.WaitGroup
mu sync.Mutex // protects ctr
@ -66,9 +66,7 @@ func keybindings(g *gocui.Gui) error {
}
func quit(g *gocui.Gui, v *gocui.View) error {
for i := 0; i < NumGoroutines; i++ {
done <- true
}
close(done)
return gocui.ErrQuit
}