1
0
mirror of https://github.com/golang/go synced 2024-11-19 18:54:41 -07:00

runtime: add NumCPU

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5528061
This commit is contained in:
Russ Cox 2012-01-09 18:45:59 -08:00
parent cbf4f4b8d0
commit 6dfdd4c1e3
2 changed files with 7 additions and 0 deletions

View File

@ -107,6 +107,9 @@ func (f *Func) FileLine(pc uintptr) (file string, line int) {
// mid returns the current os thread (m) id.
func mid() uint32
// NumCPU returns the number of CPUs on the local machine.
func NumCPU() int
// Semacquire waits until *s > 0 and then atomically decrements it.
// It is intended as a simple sleep primitive for use by the synchronization
// library and should not be used directly.

View File

@ -8,3 +8,7 @@ package runtime
func GOMAXPROCS(n int32) (ret int32) {
ret = runtime·gomaxprocsfunc(n);
}
func NumCPU() (ret int32) {
ret = runtime·ncpu;
}