Hi,
My macos has 4 cores, but i start 3 goroutines, 2 sub goroutines, 1 main
goroutine.
After main goroutine exec 3 times output, triggering gc causes
gcwaiting=1.
Finally all goroutine blocking
package main
import (
"fmt"
"log"
"net/http"
_ "net/http/pprof"
"runtime"
// "runtime"
"time"
)
func deadloop() {
for {
}
}
func main() {
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
go deadloop()
i := 3
for {
time.Sleep(time.Second * 1)
i--
fmt.Println("I got scheduled!")
if i == 0 {
runtime.GC() //will set gcwaiting=1, causes other goroutines not to be
scheduled
}
}
}
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.