Archived
1
0

An begin of the main scipt that can't be stopped

This commit is contained in:
Jip J. Dekker 2013-09-27 09:22:19 +02:00
parent edc141c99f
commit 18983c11df

27
gastenboek.go Normal file
View File

@ -0,0 +1,27 @@
package main
import "fmt"
import "os"
import "os/signal"
import "syscall"
func main() {
sigs := make(chan os.Signal, 1000000)
done := make(chan bool, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
go func() {
for i := 0; i < 3; i++ {
sig := <-sigs
fmt.Println()
fmt.Println(sig)
}
done <- true
}()
fmt.Println("awaiting signal")
<-done
fmt.Println("exiting")
}