|
|
@ -24,14 +24,19 @@ var (
|
|
|
|
delayTimeBeforeForceQuit = waitTime
|
|
|
|
delayTimeBeforeForceQuit = waitTime
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// AddShutdownListener adds fn as a shutdown listener.
|
|
|
|
|
|
|
|
// The returned func can be used to wait for fn getting called.
|
|
|
|
func AddShutdownListener(fn func()) (waitForCalled func()) {
|
|
|
|
func AddShutdownListener(fn func()) (waitForCalled func()) {
|
|
|
|
return shutdownListeners.addListener(fn)
|
|
|
|
return shutdownListeners.addListener(fn)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// AddWrapUpListener adds fn as a wrap up listener.
|
|
|
|
|
|
|
|
// The returned func can be used to wait for fn getting called.
|
|
|
|
func AddWrapUpListener(fn func()) (waitForCalled func()) {
|
|
|
|
func AddWrapUpListener(fn func()) (waitForCalled func()) {
|
|
|
|
return wrapUpListeners.addListener(fn)
|
|
|
|
return wrapUpListeners.addListener(fn)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SetTimeToForceQuit sets the waiting time before force quitting.
|
|
|
|
func SetTimeToForceQuit(duration time.Duration) {
|
|
|
|
func SetTimeToForceQuit(duration time.Duration) {
|
|
|
|
delayTimeBeforeForceQuit = duration
|
|
|
|
delayTimeBeforeForceQuit = duration
|
|
|
|
}
|
|
|
|
}
|
|
|
|