summaryrefslogtreecommitdiff
path: root/exit.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-25 02:34:49 -0500
committerJeff Carr <[email protected]>2025-10-25 02:34:49 -0500
commit87dbb0b212c48e55a50b612f022b4b035e25477f (patch)
treea156655fd9ae955fabf884cdbb816d25506b7b34 /exit.go
parent27e0ddeaf127f561ca7fd5a8083ab52eba6ca2fb (diff)
cleanup on aisle 9
Diffstat (limited to 'exit.go')
-rw-r--r--exit.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/exit.go b/exit.go
index 107230c..4bffade 100644
--- a/exit.go
+++ b/exit.go
@@ -92,3 +92,27 @@ func ExitWatchdog() {
}
}
}
+
+func Defer(dur time.Duration, f func()) {
+ dog := time.NewTicker(5 * time.Second)
+ defer dog.Stop()
+ dogchan := make(chan bool)
+ /*
+ // this example would exit/destroy the ticker in 10 seconds
+ go func() {
+ time.Sleep(10 * time.Second)
+ done <- true
+ }()
+ */
+ for {
+ select {
+ case <-dogchan:
+ fmt.Println("Done!")
+ return
+ case t := <-dog.C:
+ _ = t
+ fmt.Println("argv.Exit() watchdog: stalled in", me.pb.AppInfo.APPNAME+".Exit()")
+ // h.Scan()
+ }
+ }
+}