golib/signal upgrade

This commit is contained in:
Xing Xing 2015-01-15 10:28:21 +08:00
parent 9dbb3ea3fc
commit 939189448e

View File

@ -1,13 +1,14 @@
package main package main
import ( import (
"github.com/mikespook/gearman-go/worker"
"github.com/mikespook/golib/signal"
"log" "log"
"net" "net"
"os" "os"
"strings" "strings"
"time" "time"
"github.com/mikespook/gearman-go/worker"
"github.com/mikespook/golib/signal"
) )
func ToUpper(job worker.Job) ([]byte, error) { func ToUpper(job worker.Job) ([]byte, error) {
@ -68,7 +69,6 @@ func main() {
return return
} }
go w.Work() go w.Work()
sh := signal.NewHandler() signal.Bind(os.Interrupt, func() uint { return signal.BreakExit })
sh.Bind(os.Interrupt, func() bool { return true }) signal.Loop()
sh.Loop()
} }