func UnlockOSThread()
// GOMAXPROCS sets the maximum number of CPUs that can be executing
-// simultaneously. This call will go away when the scheduler improves.
-func GOMAXPROCS(n int)
+// simultaneously and returns the previous setting. If n < 1, it does not
+// change the current setting.
+// This call will go away when the scheduler improves.
+func GOMAXPROCS(n int) int
// Cgocalls returns the number of cgo calls made by the current process.
func Cgocalls() int64
}
// 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?
// we'll only get rescheduled once the
// number has come down.
gosched();
- return;
+ return ret;
}
// handle more procs
matchmg();
unlock(&sched);
+ return ret;
}
void
void semacquire(uint32*);
void semrelease(uint32*);
String signame(int32 sig);
+int32 gomaxprocsfunc(int32 n);
void mapassign(Hmap*, byte*, byte*);
ret = mal(n);
}
+func GOMAXPROCS(n int32) (ret int32) {
+ ret = gomaxprocsfunc(n);
+}