On Wed, Oct 5, 2016 at 7:09 AM, 刘桂祥 wrote:
>
> want to ask when the runtime decide to threadcreate : long time not return
> syscall ? any others ??
The runtime creates a new thread whenever there is a goroutine ready
to run and the number of currently running goroutines is less than
GOMAXPROCS.
package main
import (
"bufio"
"net/http"
_ "net/http/pprof"
"os"
"time"
)
func main() {
go func() {
http.ListenAndServe(":8080", nil)
}()
reader := bufio.NewReader(os.Stdin)
for i := 0; i < 100; i++ {
go func(id int) {
for {