diff options
| author | Rob Pike <r@golang.org> | 2010-05-06 11:50:47 -0700 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2010-05-06 11:50:47 -0700 |
| commit | eb48bfbbdaf3a99dbb861f251a73a3b6ae45cc8b (patch) | |
| tree | 8cb9b76a517a019f77bc2f00c2a7b2c59bf7c9c5 /src/pkg/runtime/proc.c | |
| parent | 9088f9f245e432f9f87ae8cfe46b9d36dbcf1a2e (diff) | |
| download | go-eb48bfbbdaf3a99dbb861f251a73a3b6ae45cc8b.tar.xz | |
runtime.GOMAXPROCS: hack it to have it return the old value.
R=rsc
CC=golang-dev
https://golang.org/cl/1140041
Diffstat (limited to 'src/pkg/runtime/proc.c')
| -rw-r--r-- | src/pkg/runtime/proc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index acbb3afa15..0fef16aa6e 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -1136,13 +1136,15 @@ void } // delete when scheduler is stronger -void -·GOMAXPROCS(int32 n) +int32 +gomaxprocsfunc(int32 n) { - if(n < 1) - n = 1; + int32 ret; lock(&sched); + ret = sched.gomaxprocs; + if (n <= 0) + n = ret; sched.gomaxprocs = n; sched.mcpumax = n; // handle fewer procs? @@ -1152,11 +1154,12 @@ void // we'll only get rescheduled once the // number has come down. gosched(); - return; + return ret; } // handle more procs matchmg(); unlock(&sched); + return ret; } void |
