Skip to content

Commit 1fac41d

Browse files
ZauberNerddeadprogram
authored andcommitted
src/runtime: add stub for runtime.NumCPU()
This adds a stub for the `NumCPU()` function from the `runtime` package. This change allows code to compile that tries to access this function. I guess for most hardware boards and WASM setting this value to `1` is fine. And as far as I can see it shouldn't break or change existing applications, because the function previously did not exist at all.
1 parent 1472fb6 commit 1fac41d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/runtime/debug.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package runtime
2+
3+
// NumCPU returns the number of logical CPUs usable by the current process.
4+
//
5+
// The set of available CPUs is checked by querying the operating system
6+
// at process startup. Changes to operating system CPU allocation after
7+
// process startup are not reflected.
8+
func NumCPU() int {
9+
return 1
10+
}

0 commit comments

Comments
 (0)