Skip to content

Commit af598e0

Browse files
aykevldeadprogram
authored andcommitted
runtime: implement NumCPU for the multicore scheduler
I forgot to add it in the first PR, here: #4851
1 parent 60f8a62 commit af598e0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/runtime/scheduler_cores.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ func Gosched() {
8787
task.PauseLocked()
8888
}
8989

90+
// NumCPU returns the number of CPU cores on this system.
91+
func NumCPU() int {
92+
return numCPU
93+
}
94+
9095
func addTimer(tn *timerNode) {
9196
schedulerLock.Lock()
9297
timerQueueAdd(tn)

0 commit comments

Comments
 (0)