diff options
Diffstat (limited to 'libgo/go/runtime/debug.go')
-rw-r--r-- | libgo/go/runtime/debug.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libgo/go/runtime/debug.go b/libgo/go/runtime/debug.go index 7cddd29..5be2ec4 100644 --- a/libgo/go/runtime/debug.go +++ b/libgo/go/runtime/debug.go @@ -15,6 +15,10 @@ import ( // The number of logical CPUs on the local machine can be queried with NumCPU. // This call will go away when the scheduler improves. func GOMAXPROCS(n int) int { + if GOARCH == "wasm" && n > 1 { + n = 1 // WebAssembly has no threads yet, so only one CPU is possible. + } + lock(&sched.lock) ret := int(gomaxprocs) unlock(&sched.lock) |