Created
February 1, 2019 09:04
-
-
Save imrenagi/2db2dcd5808a314a744913f1240822ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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