From c690b943b6427bf9a3bca8b88cbd8457afcaac37 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 18 Dec 2016 20:39:02 +0100 Subject: [PATCH] _examples/goroutine.go: simpler shutdown logic --- _examples/goroutine.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/_examples/goroutine.go b/_examples/goroutine.go index ad78e0d..a2d7e3d 100644 --- a/_examples/goroutine.go +++ b/_examples/goroutine.go @@ -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 }