From f7896651a4d23bf2df52d269f663498c6a30c953 Mon Sep 17 00:00:00 2001 From: mikespook Date: Mon, 9 Apr 2012 09:26:06 +0800 Subject: [PATCH] upgraded to the newest golib --- example/worker.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/example/worker.go b/example/worker.go index c8b3b5e..3247195 100644 --- a/example/worker.go +++ b/example/worker.go @@ -3,7 +3,8 @@ package main import ( "bitbucket.org/mikespook/gearman-go/gearman" "bitbucket.org/mikespook/gearman-go/gearman/worker" - "bitbucket.org/mikespook/golib/util" + "bitbucket.org/mikespook/golib/signal" + "os" "fmt" "log" "strings" @@ -21,10 +22,11 @@ func main() { w.AddFunction("ToUpperTimeOut5", ToUpper, 5) // Catch the interrupt to exit the working loop. - sh := util.NewSignalHandler(func() bool { + sh := signal.NewHandler() + sh.Bind(os.Interrupt, func() bool { w.Close() return true - }, func() bool {return true}) + }) go sh.Loop() go func() {