On Wed, Oct 5, 2016 at 7:09 AM, 刘桂祥 <liuguixiang...@gmail.com> 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. When a goroutine makes a system call or calls into C code, it is considered to be no longer running (that is, it is considered to be blocked) if it does not return quickly. In your program each goroutine that blocks reading from stdin is considered to be no longer running, so the runtime will start a new thread in order to run the new goroutine created by the loop. Ian -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.