Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
6dfdd4c1
Commit
6dfdd4c1
authored
Jan 09, 2012
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runtime: add NumCPU
R=golang-dev, bradfitz CC=golang-dev
https://golang.org/cl/5528061
parent
cbf4f4b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
src/pkg/runtime/extern.go
src/pkg/runtime/extern.go
+3
-0
src/pkg/runtime/runtime1.goc
src/pkg/runtime/runtime1.goc
+4
-0
No files found.
src/pkg/runtime/extern.go
View file @
6dfdd4c1
...
...
@@ -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.
...
...
src/pkg/runtime/runtime1.goc
View file @
6dfdd4c1
...
...
@@ -8,3 +8,7 @@ package runtime
func
GOMAXPROCS
(
n
int32
)
(
ret
int32
)
{
ret
=
runtime
·
gomaxprocsfunc
(
n
);
}
func
NumCPU
()
(
ret
int32
)
{
ret
=
runtime
·
ncpu
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment