Commit 6dfdd4c1 authored by Russ Cox's avatar Russ Cox

runtime: add NumCPU

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5528061
parent cbf4f4b8
......@@ -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.
......
......@@ -8,3 +8,7 @@ package runtime
func GOMAXPROCS(n int32) (ret int32) {
ret = runtime·gomaxprocsfunc(n);
}
func NumCPU() (ret int32) {
ret = runtime·ncpu;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment