1
0
mirror of https://github.com/golang/go synced 2024-11-20 00:44:45 -07:00

acid bug fix.

lock printf output to avoid interlacing debug prints.

R=r
DELTA=10  (7 added, 0 deleted, 3 changed)
OCL=35539
CL=35561
This commit is contained in:
Russ Cox 2009-10-09 16:45:20 -07:00
parent 7b5da358ca
commit fb1bcd47c6

View File

@ -4,6 +4,7 @@
#include "runtime.h"
static Lock debuglock;
void
dump(byte *p, int32 n)
@ -36,6 +37,8 @@ printf(int8 *s, ...)
int8 *p, *lp;
byte *arg, *narg;
lock(&debuglock);
lp = p = s;
arg = (byte*)(&s+1);
for(; *p; p++) {
@ -96,6 +99,8 @@ printf(int8 *s, ...)
}
if(p > lp)
write(1, lp, p-lp);
unlock(&debuglock);
}