golang 占满指定核CPU

package  main

import (
  "runtime"
)

func task(){
  a := 100
  for {
    a += 1
  }
}
func  main()  {
  runtime.GOMAXPROCS(1)
  go task()
  go task()
  select {}
}

你可能感兴趣的:(golang 占满指定核CPU)