You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import "runtime"
func f() {
defer func() {
recover()
}()
defer panic("will cancel Goexit but should not")
runtime.Goexit()
}
func main() {
c := make(chan struct{})
go func() {
defer close(c)
f()
for {
runtime.Gosched()
}
}()
<-c
}
The following is another example neither gc nor gccgo compiles it correctly. The example program should exit quickly in running, but in fact it never exit if it is compiled with the current versions of gc and gccgo.
In article https://go101.org/article/panic-and-recover-more.html
This example will exit since go1.14
runtime.Goexit can no longer be aborted by a recursive panic/recover.
https://golang.org/doc/go1.14#pkg-runtimeThe text was updated successfully, but these errors were encountered: