Created
February 8, 2015 20:26
-
-
Save ryanuber/368a7b8b63e76d967759 to your computer and use it in GitHub Desktop.
SIGHUP race
This file contains hidden or 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() { | |
sigCh := make(chan os.Signal) | |
signal.Notify(sigCh, syscall.SIGHUP) | |
go func() { | |
<-sigCh | |
fmt.Println("caught") | |
}() | |
time.Sleep(time.Second) | |
fmt.Println("finish") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Signal sent before handler is registered:
Handler is given a short time to complete registering: