From 89acd00955da73bb5c89ab17b2b75761183967ad Mon Sep 17 00:00:00 2001 From: astaxie Date: Fri, 9 Aug 2013 17:49:14 +0800 Subject: [PATCH] fix linux cpu 100% --- run.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/run.go b/run.go index 4be08de..cc18fa0 100644 --- a/run.go +++ b/run.go @@ -67,6 +67,7 @@ var conf struct { } func runApp(cmd *Command, args []string) { + exit := make(chan bool) if len(args) != 1 { fmt.Println("[ERRO] Argument [appname] is missing") os.Exit(2) @@ -92,7 +93,10 @@ func runApp(cmd *Command, args []string) { appname = args[0] Autobuild() for { - runtime.Gosched() + select { + case <-exit: + runtime.Goexit() + } } }