mirror of
https://github.com/golang/go
synced 2024-11-22 03:54:39 -07:00
runtime: add NumCPU
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5528061
This commit is contained in:
parent
cbf4f4b8d0
commit
6dfdd4c1e3
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user