2 Star 2 Fork 7

王布衣 / gox

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
cpus.go 203 Bytes
一键复制 编辑 原始数据 按行查看 历史
package runtime
import "runtime"
// GoMaxProcs 设置CPU核数
func GoMaxProcs(n ...int) {
numCPU := runtime.NumCPU() / 2
if len(n) > 0 && n[0] > 0 {
numCPU = n[0]
}
runtime.GOMAXPROCS(numCPU)
}
Go
1
https://gitee.com/quant1x/gox.git
git@gitee.com:quant1x/gox.git
quant1x
gox
gox
v1.21.1

搜索帮助