exit.go 280 B

1234567891011121314151617
  1. package util
  2. type ExitNotifier struct {
  3. signal chan(struct{})
  4. }
  5. func MakeExitNotifier(signal chan(struct{})) ExitNotifier {
  6. return ExitNotifier { signal }
  7. }
  8. func (e ExitNotifier) Signal() <-chan(struct{}) {
  9. return e.signal
  10. }
  11. func (e ExitNotifier) Wait() {
  12. <- e.Signal()
  13. }