use a buffered channel for quitting

This commit is contained in:
Gokcehan committed 2016-11-22 20:42:37 +03:00
1 parent c8202bbc7a
commit e643525d5c
2 files changed
+4 -5

No files matched your search

+2 -3
View File
@@ -22,7 +22,7 @@ type App struct {
func newApp() *App {
ui := newUI()
nav := newNav(ui.wins[0].h)
quit := make(chan bool)
quit := make(chan bool, 1)
return &App{
ui: ui,
@@ -190,8 +190,7 @@ func (app *App) readExpr() chan MultiExpr {
// This is the main event loop of the application. There are two channels to
// read expressions from client and server. Reading and evaluation are done on
// different goroutines except for prompting commands (e.g. "read"). Quitting
// commands should create separate goroutines to prevent deadlock here.
// different goroutines except for prompting commands (e.g. "read").
func (app *App) handleInp() {
clientChan := app.readExpr()