An begin of the main scipt that can't be stopped
This commit is contained in:
parent
edc141c99f
commit
18983c11df
27
gastenboek.go
Normal file
27
gastenboek.go
Normal 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")
|
||||||
|
}
|
Reference in New Issue
Block a user