From e395c94e5fb5ac0a5bb24573893caff53f79d89f Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 12 Jun 2025 12:01:48 +0200 Subject: [PATCH] runtime: implement NumCPU for the multicore scheduler I forgot to add it in the first PR, here: https://github.com/tinygo-org/tinygo/pull/4851 --- src/runtime/scheduler_cores.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/runtime/scheduler_cores.go b/src/runtime/scheduler_cores.go index 3b673e1e3..e261058a3 100644 --- a/src/runtime/scheduler_cores.go +++ b/src/runtime/scheduler_cores.go @@ -87,6 +87,11 @@ func Gosched() { task.PauseLocked() } +// NumCPU returns the number of CPU cores on this system. +func NumCPU() int { + return numCPU +} + func addTimer(tn *timerNode) { schedulerLock.Lock() timerQueueAdd(tn)