func (h *Handler) Register() {
	go func() {
		h.timer = time.NewTimer(time.Duration(h.timeoutSeconds) * time.Second)
		for {
			select {
			case s := <-h.signals:
				switch {
				case s == os.Interrupt:
					if h.signalReceived == 0 {
						h.signalReceived = 1
						logger.Debug("SIGINT Received")
						continue
					}
					h.signalReceived = signalTerminate
					debug.PrintStack()
					os.Exit(130)
					break
				case s == syscall.SIGQUIT:
					h.signalReceived = signalAbort
					break
				case s == syscall.SIGTERM:
					h.signalReceived = signalTerminate
					os.Exit(3)
					break
				}
			case <-h.timer.C:
				os.Exit(4)
				break
			}
		}

	}()
}
func (h *Handler) Register() {
	go func() {
		h.timer = time.NewTimer(time.Duration(h.timeoutSeconds) * time.Second)
		for {
			select {
			case s := <-h.signals:
				switch {
				case s == os.Interrupt:
					if h.signalReceived == 0 {
						h.signalReceived = 1
						logger.Debug("SIGINT Received")
						continue
					}
					h.signalReceived = signalTerminate
					debug.PrintStack()
					os.Exit(130)
					break
				case s == syscall.SIGQUIT:
					h.signalReceived = signalAbort
					break
				case s == syscall.SIGTERM:
					h.signalReceived = signalTerminate
					os.Exit(3)
					break
				}
			case <-h.timer.C:
				os.Exit(4)
				break
			}
		}

	}()
}
func ( h * Handler ) Register ( ) { go func ( ) { h . timer = time . NewTimer ( time . Duration ( h . timeoutSeconds ) * time . Second ) for { select { case s := <- h . signals : switch { case s == os . Interrupt : if h . signalReceived == 0 { h . signalReceived = 1 logger . Debug ( " " ) continue } h . signalReceived = signalTerminate debug . PrintStack ( ) os . Exit ( 130 ) break case s == syscall . SIGQUIT : h . signalReceived = signalAbort break case s == syscall . SIGTERM : h . signalReceived = signalTerminate os . Exit ( 3 ) break } case <- h . timer . C : os . Exit ( 4 ) break } } } ( ) }
// Register starts handling signals.
Register starts handling signals .