signal wait to block for end
rgb/pipeline/head This commit looks good Details

pull/3/head
Nathan 2 years ago
parent 5f320f8ca7
commit 7211d97fd5

@ -8,6 +8,8 @@ import (
_ "image/jpeg" _ "image/jpeg"
"log" "log"
"os" "os"
"os/signal"
"syscall"
"time" "time"
rgbmatrix "gitea.wagshome.duckdns.org/publicWagsHome/go-rpi-rgb-led-matrix" rgbmatrix "gitea.wagshome.duckdns.org/publicWagsHome/go-rpi-rgb-led-matrix"
@ -76,6 +78,18 @@ func main() {
log.Println("making animator") log.Println("making animator")
go animator(tk, mqMessages) go animator(tk, mqMessages)
log.Println("I guess I'm at the end") log.Println("I guess I'm at the end")
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
done := make(chan bool, 1)
go func() {
sig := <-sigs
fmt.Println()
fmt.Println(sig)
done <- true
}()
fmt.Println("awaiting signal")
<-done
fmt.Println("exiting")
} }
func listener(mqMessages chan mqtt.Message) { func listener(mqMessages chan mqtt.Message) {

Loading…
Cancel
Save