mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 21:13:39 +00:00
runtime: implement NumCPU for -scheduler=threads
For the threads scheduler, it makes sense to have NumCPU available. For all other schedulers, the number of available CPUs is practically limited to one by the scheduler (even though the system might have more CPUs).
This commit is contained in:
committed by
Ron Evans
parent
25b83920b6
commit
02c5c4213c
@@ -50,6 +50,11 @@ func Gosched() {
|
||||
// operation, so is probably best not to use.
|
||||
}
|
||||
|
||||
// NumCPU returns the number of logical CPUs usable by the current process.
|
||||
func NumCPU() int {
|
||||
return task.NumCPU()
|
||||
}
|
||||
|
||||
// Separate goroutine (thread) that runs timer callbacks when they expire.
|
||||
func timerRunner() {
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user