move out c/cpp/py

This commit is contained in:
Li Jie
2025-04-03 15:52:18 +08:00
parent 0a8a4eb6a6
commit ed366568b4
777 changed files with 4608 additions and 139122 deletions

57
cl/_testgo/goexit/in.go Normal file
View File

@@ -0,0 +1,57 @@
package main
import (
"runtime"
)
func main() {
demo1()
demo2()
demo3()
}
func demo1() {
ch := make(chan bool)
go func() {
defer func() {
ch <- true
}()
runtime.Goexit()
}()
<-ch
}
func demo2() {
ch := make(chan bool)
go func() {
defer func() {
if r := recover(); r != nil {
panic("must nil")
}
ch <- true
}()
runtime.Goexit()
}()
<-ch
}
func demo3() {
ch := make(chan bool)
go func() {
defer func() {
r := recover()
if r != "error" {
panic("must error")
}
ch <- true
}()
defer func() {
if r := recover(); r != nil {
panic("must nil")
}
panic("error")
}()
runtime.Goexit()
}()
<-ch
}