mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 02:35:53 +08:00
@@ -66,8 +66,9 @@ Go 的并发原语提供了良好的并发设计基础:表达程序结构以
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
var numCores = flag.Int("n", 2, "number of CPU cores to use")
|
var numCores = flag.Int("n", 2, "number of CPU cores to use")
|
||||||
|
```
|
||||||
in main()
|
在 main() 中:
|
||||||
|
```go
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
runtime.GOMAXPROCS(*numCores)
|
runtime.GOMAXPROCS(*numCores)
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user