func SecondFunc(fn ShutdownFn, v interface{}) Notifier {
	return onFunc(2, fn, v)
}
SecondFunc executes a function in the second stage of the shutdown
package shutdown
import (
	"log"
	"os"
	"os/signal"
	"sync"
	"time"
)
type Stage struct {
	n int
}
var Logger = log.New(os.Stderr, "[shutdown]: ", log.LstdFlags)
var Preshutdown = Stage{0}  
var Stage1 = Stage{1}       
var Stage2 = Stage{2}       
var Stage3 = Stage{3}       
type Notifier chan chan struct{}
type fnNotify struct {
	client   Notifier
	internal Notifier
	cancel   chan struct{}
}
var sqM sync.Mutex  
var shutdownQueue [4][]Notifier
var shutdownFnQueue [4][]fnNotify
var shutdownFinished = make(chan struct{}, 0)  
var srM sync.RWMutex  
var shutdownRequested = false
var timeouts = [4]time.Duration{5 * time.Second, 5 * time.Second, 5 * time.Second, 5 * time.Second}
func SetTimeout(d time.Duration) {
	srM.Lock()
	for i := range timeouts {
		timeouts[i] = d
	}
	srM.Unlock()
}
func SetTimeoutN(s Stage, d time.Duration) {
	srM.Lock()
	timeouts[s.n] = d
	srM.Unlock()
}
func (s *Notifier) Cancel() {
	srM.RLock()
	if shutdownRequested {
		srM.RUnlock()
		return
	}
	srM.RUnlock()
	sqM.Lock()
	var a chan chan struct{}
	var b chan chan struct{}
	a = *s
	for n, sdq := range shutdownQueue {
		for i, qi := range sdq {
			b = qi
			if a == b {
				shutdownQueue[n] = append(shutdownQueue[n][:i], shutdownQueue[n][i+1:]...)
			}
		}
		for i, fn := range shutdownFnQueue[n] {
			b = fn.client
			if a == b {
				for i := range shutdownQueue[n] {
					b = shutdownQueue[n][i]
					if fn.internal == b {
						shutdownQueue[n] = append(shutdownQueue[n][:i], shutdownQueue[n][i+1:]...)
					}
				}
				close(fn.cancel)
				shutdownFnQueue[n] = append(shutdownFnQueue[n][:i], shutdownFnQueue[n][i+1:]...)
			}
		}
	}
	sqM.Unlock()
}
func PreShutdown() Notifier {
	return onShutdown(0)
}
type ShutdownFn func(interface{})
func PreShutdownFunc(fn ShutdownFn, v interface{}) Notifier {
	return onFunc(0, fn, v)
}
func First() Notifier {
	return onShutdown(1)
}
func FirstFunc(fn ShutdownFn, v interface{}) Notifier {
	return onFunc(1, fn, v)
}
func Second() Notifier {
	return onShutdown(2)
}