> > > Replace : > go func() {
for { > } > }() > With: > > go func() { > ct := 0 > t1 := time.Now().UnixNano() > for { > ct++ > if ct%600000000 == 0 { > t2 := time.Now().UnixNano() > fmt.Println("hooray", t2, t1, float64(t2-t1)/1e6) > t1 = t2 > } > } > }() > But how could you explain this situation? *This piece code is not "dead spin", it is just cpu intensive*. > Thus the program does not stuck anymore -- *But whole process* *is thrashing **and churning*! (With a time delay nearly 100-200ms based on value '600000000' and the speed of your computer) Is this a big flaw for golang when fulfill some cpu intensive staff? On Wednesday, 21 June 2017 18:51:49 UTC+8, Dave Cheney wrote: > > Go is not good for functions which never call other, take locks, read or > write data, or communicate with others. In practice, most code does one or > more of these things so it's rarely an issue. -- 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.