upgraded to the newest golib
This commit is contained in:
parent
59e061e094
commit
f7896651a4
@ -3,7 +3,8 @@ package main
|
|||||||
import (
|
import (
|
||||||
"bitbucket.org/mikespook/gearman-go/gearman"
|
"bitbucket.org/mikespook/gearman-go/gearman"
|
||||||
"bitbucket.org/mikespook/gearman-go/gearman/worker"
|
"bitbucket.org/mikespook/gearman-go/gearman/worker"
|
||||||
"bitbucket.org/mikespook/golib/util"
|
"bitbucket.org/mikespook/golib/signal"
|
||||||
|
"os"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
@ -21,10 +22,11 @@ func main() {
|
|||||||
w.AddFunction("ToUpperTimeOut5", ToUpper, 5)
|
w.AddFunction("ToUpperTimeOut5", ToUpper, 5)
|
||||||
|
|
||||||
// Catch the interrupt to exit the working loop.
|
// Catch the interrupt to exit the working loop.
|
||||||
sh := util.NewSignalHandler(func() bool {
|
sh := signal.NewHandler()
|
||||||
|
sh.Bind(os.Interrupt, func() bool {
|
||||||
w.Close()
|
w.Close()
|
||||||
return true
|
return true
|
||||||
}, func() bool {return true})
|
})
|
||||||
go sh.Loop()
|
go sh.Loop()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user