Yes, my fault. Thanks for pointing it out. What happens if I remove the fmt.Printf function calls to have the following code:
package main import ( "fmt" "runtime" "time" ) func main() { count := runtime.GOMAXPROCS(1) fmt.Printf("GOMAXPROCS: %d\n", count) // goroutine 1 go func() { for { } }() // goroutine 2 go func() { for { } }() time.Sleep(10 * time.Second) } Can goroutine 1 or goroutine 2 be preempted? If yes, by which mechanism? On Friday, February 22, 2019 at 4:20:12 PM UTC+8, Ian Denhardt wrote: > > Quoting Jingguo Yao (2019-02-22 03:17:33) > > Since both goroutines do not make any function calls > > fmt.Printf is a function. > -- 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.