Created
August 16, 2016 23:19
-
-
Save billyfbrain/91bb3aed87ec550ede4b676975af6164 to your computer and use it in GitHub Desktop.
stop server
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
| type Server struct { | |
| ctx context.Context | |
| Stop context.CancelFunc | |
| } | |
| func (s *Server) IsShutdown() bool { | |
| select { | |
| case <-s.ctx.Done(): | |
| return true | |
| default: | |
| return false | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment