diff options
author | Russ Cox <rsc@golang.org> | 2009-10-09 16:45:20 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-10-09 16:45:20 -0700 |
commit | d7ada8a4acc9617332444573cf4e44d1e2ced29d (patch) | |
tree | 77261b3f418d5e0f29938936a5991f3480a20663 /src | |
parent | 09135692454e5dd128d172a0bcf1f85409aedcdd (diff) | |
download | golang-d7ada8a4acc9617332444573cf4e44d1e2ced29d.tar.gz |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/pkg/runtime/print.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pkg/runtime/print.c b/src/pkg/runtime/print.c index c9929cd45..fb2881be5 100644 --- a/src/pkg/runtime/print.c +++ b/src/pkg/runtime/print.c @@ -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); } |