Skip to content

Instantly share code, notes, and snippets.

@imrenagi
Created February 1, 2019 09:04
Show Gist options
  • Save imrenagi/2db2dcd5808a314a744913f1240822ef to your computer and use it in GitHub Desktop.
Save imrenagi/2db2dcd5808a314a744913f1240822ef to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
)
func main() {
go func() {
for {
<-time.After(1 * time.Second)
fmt.Println("1 sec")
}
}()
go func() {
for {
<-time.After(5 * time.Second)
fmt.Println("5 sec")
}
}()
cc := make(chan os.Signal, 1)
signal.Notify(cc, syscall.SIGINT, syscall.SIGTERM)
<-cc
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment