change meaning of $GOMAXPROCS to number of cpus to use,

not number of threads.  can still starve all the other threads,
but only by looping, not by waiting in a system call.

fix darwin syscall.Syscall6 bug.

fix chanclient bug.

delete $GOMAXPROCS from network tests.

add stripped down printf, sys.printhex to runtime.

R=r
DELTA=355  (217 added, 36 deleted, 102 changed)
OCL=20017
CL=20019
This commit is contained in:
Russ Cox 2008-11-25 16:48:10 -08:00
parent 7cfa7eebf3
commit efc86a74e4
10 changed files with 312 additions and 131 deletions

View file

@ -248,9 +248,11 @@ func (fd *FD) Write(p *[]byte) (n int, err *os.Error) {
if fd == nil || fd.osfd == nil {
return -1, os.EINVAL
}
// TODO(rsc): Lock fd while writing to avoid interlacing writes.
err = nil;
nn := 0;
for nn < len(p) && err == nil {
// TODO(rsc): If os.FD.Write loops, have to use syscall instead.
n, err = fd.osfd.Write(p[nn:len(p)]);
for err == os.EAGAIN {
pollserver.WaitWrite(fd);