diff options
| author | Jeff Carr <[email protected]> | 2023-03-26 17:19:20 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-03-26 17:19:20 -0500 |
| commit | 6013fde8332e8ecbffaf1a0977ba2e1da8ea8775 (patch) | |
| tree | 3f9ccd75e8699974f3412fdd79a20173672c19c2 /chan.go | |
| parent | 6f91f5e080e06cdc0f34b13d23e5fd16ea37259a (diff) | |
improvements towards a working dns control panel
democui has the help menu
try to add mouse support to gocui
make a direct access method
Margin() and Pad() tests
add SPEW
also push devel branch to github
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'chan.go')
| -rw-r--r-- | chan.go | 33 |
1 files changed, 31 insertions, 2 deletions
@@ -8,8 +8,10 @@ import ( // "regexp" // "git.wit.org/wit/gui/toolkit" "sync" + "runtime" "github.com/sourcegraph/conc" "github.com/sourcegraph/conc/stream" + "github.com/sourcegraph/conc/panics" ) func makeConc() { @@ -17,15 +19,42 @@ func makeConc() { defer wg.Wait() startTheThing(&wg) + log(debugError, "panic?") + sleep(2) + log(debugError, "panic? after sleep(5)") } func startTheThing(wg *conc.WaitGroup) { - wg.Go(func() { - log(debugNow, "startTheThing()") + f := func() { + log(debugError, "startTheThing() == about to panic now") panic("test conc.WaitGroup") + } + wg.Go(func() { + ExampleCatcher(f) }) } +func ExampleCatcher(f func()) { + var pc panics.Catcher + i := 0 + pc.Try(func() { i += 1 }) + pc.Try(f) + pc.Try(func() { i += 1 }) + + recovered := pc.Recovered() + + log(debugError, "panic.Recovered():", recovered.Value.(string)) + frames := runtime.CallersFrames(recovered.Callers) + for { + frame, more := frames.Next() + log(debugError, "\t", frame.Function) + + if !more { + break + } + } +} + func mapStream( in chan int, out chan int, |
