diff options
Diffstat (limited to 'src/runtime/debug.go')
| -rw-r--r-- | src/runtime/debug.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/runtime/debug.go b/src/runtime/debug.go index bdaaa7196d..c7592d3329 100644 --- a/src/runtime/debug.go +++ b/src/runtime/debug.go @@ -39,7 +39,7 @@ func GOMAXPROCS(n int) int { lock(&sched.lock) ret := int(gomaxprocs) - if n <= 0 || n == ret { + if n <= 0 { unlock(&sched.lock) return ret } @@ -52,6 +52,12 @@ func GOMAXPROCS(n int) int { lock(&computeMaxProcsLock) unlock(&computeMaxProcsLock) + if n == ret { + // sched.customGOMAXPROCS set, but no need to actually STW + // since the gomaxprocs itself isn't changing. + return ret + } + stw := stopTheWorldGC(stwGOMAXPROCS) // newprocs will be processed by startTheWorld |
