摘要: 使用了goroutine实现了多线程,使用chan来控制多线程。 runtime.GOMAXPROCS(3)来设置最大的原生线程。 runtime.Gosched() 显式地让出CPU时间给其他goroutine 代码如下: 1 package main 2 3 import ( 4 "fmt" 5 阅读全文
posted @ 2019-01-21 16:55 孤独信徒 阅读(8413) 评论(5) 推荐(0) 编辑