diff options
Diffstat (limited to 'src/runtime/testdata')
| -rw-r--r-- | src/runtime/testdata/testprogcgo/callback.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/runtime/testdata/testprogcgo/callback.go b/src/runtime/testdata/testprogcgo/callback.go index 319572fe10..39993f13a6 100644 --- a/src/runtime/testdata/testprogcgo/callback.go +++ b/src/runtime/testdata/testprogcgo/callback.go @@ -38,10 +38,21 @@ import ( func init() { register("CgoCallbackGC", CgoCallbackGC) + register("CgoToGoCallGoexit", CgoToGoCallGoexit) } +func CgoToGoCallGoexit() { + goexit = true + C.foo() +} + +var goexit = false + //export go_callback func go_callback() { + if goexit { + runtime.Goexit() + } if e := extraMInUse.Load(); e == 0 { fmt.Printf("in callback extraMInUse got %d want >0\n", e) os.Exit(1) |
