package main
import (
"fmt"
"time"
)
var i uint32
func main() {
//fn, _ := os.OpenFile("cpu.profile", os.O_CREATE|os.O_RDWR, 0644)
//defer fn.Close()
//pprof.StartCPUProfile(fn)
//defer pprof.StopCPUProfile()
go add()
time.Sleep(1 * time.Second)
fmt.Println(i)
}
func add() {
for {
i++
time.Sleep(1 * time.Millisecond)
}
}
预期打印接近1000的数字,最后打印了870左右的数字。老师,请问这是什么原因?