Golangcode基础笔记b06_goroutine

package main
//goroutine
import (
    "fmt"
    "time"
)

func main() {
    for i := 0; i < 1000; i++ {
        go func(i int) {
            for {
                fmt.Printf("Hello from "+
                    "goroutine %d\n", i)
            }
        }(i)
    }
    time.Sleep(time.Minute)
}

猜你喜欢

转载自blog.csdn.net/boss2967/article/details/82717751