From 1fac41d53510c65fb39765aea50f94812c2fe02b Mon Sep 17 00:00:00 2001 From: ZauberNerd Date: Fri, 4 Mar 2022 15:21:55 +0000 Subject: [PATCH] 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. --- src/runtime/debug.go | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/runtime/debug.go diff --git a/src/runtime/debug.go b/src/runtime/debug.go new file mode 100644 index 00000000..8a69c6e2 --- /dev/null +++ b/src/runtime/debug.go @@ -0,0 +1,10 @@ +package runtime + +// NumCPU returns the number of logical CPUs usable by the current process. +// +// The set of available CPUs is checked by querying the operating system +// at process startup. Changes to operating system CPU allocation after +// process startup are not reflected. +func NumCPU() int { + return 1 +}